Yes, that is what I said. :FireServer()
is used in the client, so the player is automatically sent as the first argument when receiving it in a server script with OnServerEvent
.
Nope. The event isn’t the same
Honestly, that was just my brain being wonky. You’re correct.
Client changes will not appear to other clients.
Example:
change money to 5 on client
other clients can’t see the change
change money to 10 on server
other clients see 10
change money to 8 on client
other clients still see 10
What do you mean the event isn’t the same? To send info from client to server, you need to fire and receive from a RemoteEvent or RemoteFunction using both a local and server script.
Example (remoteevent in replicatedstorage)
Local:
game:GetService("ReplicatedStorage").RemoteEvent:FireServer("hi from client")
Server:
game:GetService("ReplicatedStorage").RemoteEvent.OnServerEvent:Connect(function(plr, msg)
-- do something with client info
end)
The server and client should be using the same events and with the correct parameters (in this case, the OnServerEvent
automatically has the client player as the first argument).
I know, what my problem was (probably). All this time I could have used the serverscript that puts the part into workspace and connected the script that makes the sound and stuff to it using a bindable event just like how you did it. Thanks guys.
I thought you were talking about the 2 different events that are used for the 2 sets of scripts. The scripts all had the correct event connected to it.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.