so what this basically does is when I press F then it will fire a remoteEvent which will then be handled by the server then the server will fireallClient then the Replicate(LOcalScript) will create a part so a part will be created for the screen of players.
SCRIPT SAMPLE
Trigger(Local Script)
local function onTrigger()
RemoteEvent1:FireServer()
end
Checker(Server Script)
function onRemoteEvent1()
RemoteEvent2:FireAllClient()
end
Replicator(Local Script)
function onRemoteEvent2()
Instance.new("Part",workspace)
end
Why not let the server create the part?
It has a delay so what I do is when the player triggers the Trigger script then it will first create a part for him before telling the server to create parts for all players so the player wouldnt know its delayed.
Im asking because I want to know if theres a better way or if this would cause lag.
This is usually the way that I do it in all of my games, and if you’re spawning a physics-based object like Parts, having them simulated on the client instead of on the server allows for less lag. You will have to implement some sanity checks and more.
It’s just not the server lagging, you used the parent argument which causes it to become more slower, i don’t know much what causes this but i have read that every part is memory block and something that relates to the changing of bytes in the memory block causing some little delay on the code.
So not only the server is lagging, the way you use Instance.new() also makes it more laggier and more delayed, read this post.
I’d reccomend you to run that loop on the server, as now it has to run on clientA, then get recieved on the server at pretty much the same time, and then all 10 of them will get replicated to the other clients.