Wait, so I suppose the client needs to handle the remote event first?
I did this,
local RS = game:GetService(“ReplicatedStorage”)
local RemoteEvent = RS:WaitForChild(“RemoteEvent”)
local Players = game:GetService(“Players”)
and it’s fixed, but is there like any other solution? I still don’t get it which side should handle the remote event first.
Wait, I realized that the tween is not playing at the same time for one player and another. The object that is being tweened is not moving at the same position.
Is there any way to fix this? help
Its honestly easier to simply tween on the server.
The client side is unique for each player, so you can set different tweens for each one if you wanted to.
Also, if you fire all clients every time a character is added, this will attempt to run your Tween function on each client again. It will probably resolve the conflicts itself, but
But like, isn’t it laggy to tween on the server. I heard that it’s better to tween on the client.
If the server runs the Tween the clients will get updated by the server. If the client is receiving the update later due to lag, it may look less smooth or ‘laggy’.
If you run the Tween on the client, but the client gets the remote event later than others due to lag it will run out of sync, but be smoother (assuming the client’s machine can handle everything).
So I guess it depends what the Tween is controlling and how that fits in with the rest of your game.
So is it okay if I play the tween in a local script without firing remote events?
Yes. It might be out of sync with other players’ as they see it (so might not be good if you are relying on the part for hit detection etc) but if its just visuals it should be fine to run the tween on the client and you won’t need to send unneccessary events to all clients.
You could of course change the script to fire to the specific client when that player joins. ie
It really depends how much control you want over it from the server.
So if I tweened it in a local script, hackers also won’t be able to like change it or anything right. I’m also not that familiar with FireAllClients, can you give me some examples of why I would use it?
Hackers would have total control over anything on their client. So like I said, if it’s just visual effects it probably won’t make much difference to you or other players. But if it is integral to how your game works then you would almost certainly want to control it from the server or at least have some sort of check that it’s not being manipulated. There are plenty of other threads regarding anti exploit (and how difficult it is to implement!)
I would use fireallclients() when I want to activate a remoteevent for every player at the same time but where each client may need to handle it differently using a local script e.g. a GUI popup with their player name and their score at the end of a round.
Fireclient() would be to change something for a single named player e.g. they touched a part to alter their GUI to red.
So how would I do RemotEvent:FireAllClients when all the clients have loaded in? What is displayed on all of the clients screen is the same. So Let’s say there’s an npc with their dialogue GUI, I want it to display on all the clients screen in the same time. As the dialogue GUI will appear and end at the same time for all clients. Without having it to play at a different position for different clients as that will mess things up.
All clients would need to have loaded before using fireallclients (), as they would miss out if loading in after.
As for the event triggering this you would just need to check all the players had loaded in prior to firing.
So do I use like player.CharacterAdded:Wait? (To load for all the clients) I did that but it didn’t work.
And if I fire a remote event from the server to the client, then the server should handle the remote event first? and client to server, the other way around.