Scripting Helpers is winding down operations and is now read-only. More info→
Log in to vote

When I uncomment 'print(Step)' the car goes way faster?

Asked by 7 years ago

Hello. I have been playing around with CFrames recently and when I noticed that my hover car started going slower when I removed the prints from my script. I added a print, then it went really fast and vice versa.

Could anyone please help me find the reason behind this?

(the print is on line 18)

local Step = 0
RunService:BindToRenderStep("Hover Cars", 198, function()
    local t1 = tick()
    for i, v in pairs(Forces) do
        -- This looks prettier
        local obj = v[3]
        local vf = v[2]
        local hf = v[1]

        if obj then
            -- Assuming obj is a model w/ primarypart
            obj:SetPrimaryPartCFrame(obj.PrimaryPart.CFrame *, vf * Step, (hf * Step) * -1)) -- no strafing scrubs
            -- Remove unnesecary force data for faster render time
            table.remove(Forces, Forces[i])
    Step = tick() - t1
It's your computer or the government. Or aliens. Programical 653 — 7y
oh ok User#15029 30 — 7y
Try putting a wait(), see if it works faster, as well. Maybe the BindToRenderStep to going too fast, and about to crash the system? JasonTheOwner 391 — 7y

Answer this question