I have a RemoteEvent that fires to all clients and it rotates a part and then slowly stops it from rotating. It does this fine but the problem is that the clients wont properly sync up and the part stops rotating at different times on all clients. I think I can use DeltaTime to fix this but I don’t know how to use DeltaTime properly. Here’s my code:
local SpinSpeed = 30
local part = workspace.Part
game.ReplicatedStorage.ConnectToClients.OnClientEvent:Connect(function()
runService.RenderStepped:Connect(function()
if SpinSpeed > 0 then
part.CFrame = part.CFrame * CFrame.Angles(0,0,math.rad(SpinSpeed))
SpinSpeed -= 0.1
end
end)
end)
Maybe try setting the network owner to the server. I am not that smart when it comes to client-side problems. Does the code need to be on the client-side?
game.ReplicatedStorage.ConnectToClients.OnClientEvent:Connect(function(cframe)
part.CFrame =cframe
end)
runService.RenderStepped:Connect(function()
if SpinSpeed > 0 then
part.CFrame = part.CFrame * CFrame.Angles(0,0,math.rad(SpinSpeed))
SpinSpeed -= 0.1
end
end)
now make a serverscript with while true do wait() but this would be useless. :')
Ping wouldn’t be the issue as I’m testing on a Local Server and I’m pretty sure they run on your own computer so that would mean all of the “Player’s” ping would be 0. I believe it is the fact that the FPS is different for all players so it’s not synced up correctly as I’m using a .RenderStepped function. I believe using DeltaTime could fix this, but again I am not familiar with DeltaTime and I don’t know where to put it in the code to make it work.