I wanna double check if this is correct...
If I want to fire a remove event from a local script to local script is this what I do correct?
Local script:
game.ReplicatedStorage.EventName:FireServer()
Script:
game.ReplicatedStorage.EventName.OnServerEvent:Connect(function(plr) game.ReplicatedStorage.EventName2:FireClient(plr) -- Firing to local script end)
local script that wanted to be fired:
game.ReplicatedStorage.EventName2.OnClientEvent:Connect(function(plr) end)
I want to see if I did the script correct for :FireClient()
AND if that player can only see it and not everyone. Thanks!
Alright, so let me explain what you're doing. First, you're firing to the server. Then you're receiving that remote on the server, and firing back to the client, with the argument from the .OnServerEvent, which means you're firing the remote back only to the player that fired it to the server, and then you're receiving it on the client with .OnClientEvent. So for the first question, the only thing wrong is the .OnClientEvent argument, which is not the player, unlike .OnServerEvent. So it'd look like:
game.ReplicatedStorage.EventName2.OnClientEvent:Connect(function() -- first argument will be the first argument sent by :FireClient(), not the player end)
And for the second question, the player will only see if you make those changes on the client, which you could do on the script that fires to the server, or on the .OnClientEvent. If you want to make everyone see, you could make the change on the .OnServerEvent, or you could do :FireAllClients() on the .OnServerEvent (:FireAllClients() do not need a player argument to be fired). I hope this helped you (if it wasn't confusing)