Hi there. I’m trying to write code for a pillow that ragdolls whoever you hit. I combined a push tool and a ragdoll script and managed to make yourself ragdoll when you use the pillow, so I know it works fine. However, I have no idea how to fire an event for a certain player coming from another player’s script. I already have a way to detect what player was hit, but I just don’t know how to fire the event for that player only. Any suggestions? (PS sorry if this was already a topic, I just couldn’t find anything).
I may be wrong here because I have for some reason never needed to do this but can’t you use a remote event to then fire the other player. I don’t know if it has to go through the server tho because I have never done this.
I don’t mean fire a RemoteEvent to then fire another player’s RemoteEvent, I mean is there a way to fire another player’s RemoteEvent from a regular Script? I know there’s this:
RemoteEvent:FireServer()
…but could there be some way to do something like this?
I don’t think there is a way to avoid passing the player firing the remote to the server, although you are still able to do:
Remote.OnServerEvent:Connect(function(player1, player2)
--run code for player2
end)
Also you don’t need to fire the other remote in the first place, you can apply the changes made directly in the script that receives the “request” to access another user remote(which must be a server script anyway).
PS: RemoteEvent:FireServer() can only be used inside client scripts.
Will the code put into this function also apply to player1? And since I have never worked with something like this before, do I define player2, or does it do it on its own?