Hello everyone! I am trying to run a FireClient from a script under a TextButton. Script:
function leftClick()
print("click")
game.ReplicatedStorage.RemoteEvent2:FireClient(Player)
end
script.Parent.MouseButton1Click:Connect(leftClick)
However, it does not seem to work. Error, “FireClient: player argument must be a Player object”. I want to put in a player, but I want that to be the player who clicked the button. How do I do that?
No. Client side is only on the client. Do it in a local script patented under your gui and if the server needs to do anything, do RemoteEvent2:FireServer(info)
So I need to change it to a normal script or something? I have another script with somewhat of the same goal in StarterPlayerScripts, and that one does work. However that one uses a OnClientEvent.
OnClientEvent is only used when a script (server-side) fired a remote event to the client-side. You would use this for local script (client-side) when getting the events that is fired from the server-side.
OnServerEvent is only used when a local script (client-side) fired a remote event to the server-side. You would use this for server-side (script) when getting the events that is fired from the local script (client-side).