Title explains everything.
I want to make any script that runs on the server, replicate to all the clients like usual, but except some players. How do I do this?
Title explains everything.
I want to make any script that runs on the server, replicate to all the clients like usual, but except some players. How do I do this?
Use a remote event, call :FireClient
on the players you want to replicate something to.
No, it’s :FireAllClient
she want the server script to not only run on certain clients
I could do this but my code runs in a loop every wait(). I don’t want to flood the client. I am making a day and night cycle that changes the time of day.
you could also do :FireAllClients(Table of players you want it to effect)
and on every client it checks if the localplayer is in the list and if it is then run the script
Why don’t just change this on the lightning ? (server side)
That is what I do, but I want the time to be different on one client.
Well on the server make a remote event that call the client your want with :FireClient
and send him the time, after the local script of the client will receive the request and change the lightning (client side)
See RemoteEvent here
yes, but if you fire client and keep firing client over and over and over again every single wait() then it will give you a warning. My day night cycle updates every 0.05 seconds. Would I have to change the update time? It will also slow every other remote event I use
send one request to the client that contain 2 information, the current time (the beginning) and the time where it should go (the end).
Then you have to increase little by little the one where it starts, so that it is equal to the one where it must end (on the client side)
I will try this and mark it as solution when I am done. Thank you!
This isn’t a thing, FireAllClients fires to every client. You need to loop through all the players that you want to send data to and use FireClient(plr).
Where in the documentation does it say you can pass a table of players as an argument (you can pass a table of players but it will not only fire to those players). Read the docs before you reply.
use the ingame time in the lighting but change it on the client instead of the server
on every client you can check if the localplayer is in the list on a localscript
On the server, you need to loop through the clients and then use :FireClient() for each loop.
You CANNOT use :FireAllClients() and specify which clients receive the fire.
local playersToFire = {} -- Use their In game usernames
for i,v in pairs(playersToFire) do
remoteEvent:FireClient(game.Players:FindFirstChild(v))
end
I typed that code here in the DevForum box so some of it may be off when you put it in studio.
Good luck!