I've already tried
remoteEvent:FireAllClients()
remoteEvent:FireServer()
But it did not work. It said FireServer
could only be used by the client. I've also tried:
--No server script em workspace
remoteEvent:FireClient(script.LocalScript)
--No local script em workspace.Script
remoteEvent.OnClientEvent:connect(function()
remoteEvent:FireServer()
end)
But it also did not work. Only when I changed the location of the local script to StarterPlayer.StarterPlayerScripts
and changing the argument from FireClient
to game.StarterPlayer.StarterPlayerScripts.LocalScript
worked.
I then changed the argument from FireClient
to game.Players.Player1
(the test player in Studio) and it also worked.
But to complicate, I can not insert the local script in game.StarterPlayer.StarterPlayerScripts
because this folder inserts everything in it (including non-scripts) into a folder called PlayerScripts
inside a player that enters the game, all players will be left with the localscript that will trigger the remote event, which can not be fired several times at once.
But at last I need a script that triggers the remote event for the server and the client.
PS: For those who want to help me, but do not have much experience with ROBLOX Studio, I will explain briefly: Server scripts will only act on the server and local scripts will act on the client (on the player's PC) and remote events are objects in the which has 2 special events, one will be detected by the server scripts ( OnServerEvent
) and the other will be detected by the local scripts ( OnClientEvent
) and that can trigger these events when "listening" the functions FireServer
, FireClient
and FireAllClients
, which I do not need to explain what they will do because if you play moon games it is because you know English