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 * CFrame.new(0, vf * Step, (hf * Step) * -1)) -- no strafing scrubs
		else
			-- Remove unnesecary force data for faster render time
			table.remove(Forces, Forces[i])
		end
	end
	--print(Step)
	Step = tick() - t1
end)

3 comments

0

It's your computer or the government. Or aliens.

0

oh ok

0

Try putting a wait(), see if it works faster, as well. Maybe the BindToRenderStep to going too fast, and about to crash the system?