#help with spaceship system

2 messages · Page 1 of 1 (latest)

rain wedge
#

try using a heartbeat connection, the renderstepped fires every frame but using the wait() on it will cause inconsistent timing. instead you can use a heartbeat connection for it to be faster rotation update.

local rotationDelay = 0.001
local rotationTimer = 0
local targetPos = Mouse.Hit.Position
local lookVector = (targetPos - Seat.Position).Unit
local rotation = CFrame.new(Seat.Position, Seat.Position + lookVector)

game:GetService("RunService").Heartbeat:Connect(function(deltaTime)
    rotationTimer = rotationTimer - deltaTime

    if rotationTimer <= 0 then
        Seat.CFrame = rotation
        rotationTimer = rotationDelay
    end
end)

in this code the heartbeat event is used to continuously update the seats rotation. the deltaTime parameter represents the time elapsed since the last heartbeat event.
you can also try messing with the rotation delay and experiemnt what is better for what your looking for

west geodeBOT
#

studio** You are now Level 1! **studio