I’m trying to make a moving model using CFrame, Not using Server Script because In-Game it’s very laggy.
This is the script in the actual game.
This is the script in studio, there’s a huge difference.
This is the CFrame script i was using in the Model, I just don’t know how to make a run locally and fire it on all clients at the same time.
local vehicle = script.Parent
local speed = 5-- studs per second
game:GetService("RunService").Heartbeat:Connect(function(dt) -- 'dt' is the time in seconds since the last physics frame, we can use it to more accurately calculate the vehicle's position WRT time.
vehicle:SetPrimaryPartCFrame(vehicle.PrimaryPart.CFrame * CFrame.new(2, 0, 0 * speed * dt))
end)
I’m new to scripting so I may not know some things.
In the video he is literally doing what I said, setting the network owner to the server from a local script, in fact in the api reference he recommends you to set it to nil (server) .
But did you not watch the whole video. He states that its now the server that has all the pressure on calculating all the physics 47:50. He suggests a better option.
Edit:
Like @gmtojay said as well, it would be better to move the moving parts locally. In that video, it shows an example.
Well yeah, I haven’t continued watching the video, maybe putting the movement of the vehicle in a localscript is a better idea, anyways thanks for correcting me.