Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

why is my Cframed brick going so fast, can you guys tell me?

so today i discovered Cframes i have been messing with them

brick = script.Parent
	while true do 
	wait(0.001)
	brick.CFrame = brick.CFrame * CFrame.fromEulerAnglesXYZ(0.01,02,0)
	
	end
	
	

pls help

1 answer

✓ Accepted answer

You're moving your brick 2 radians (about 114 degrees) in the y-axis every fraction of a second, which is a really big leap. You could do the following:

brick = script.Parent
while wait() do 
	brick.CFrame = brick.CFrame * CFrame.fromEulerAnglesXYZ(0 ,math.rad(1),0)
end

But I prefer to do the following:

brick = script.Parent

--runs the loop every 0.03 seconds (the default wait time)
while wait() do 
	--rotate the brick 1 degree in the x axis
	brick.CFrame = brick.CFrame * CFrame.Angles(math.rad(1), 0, 0)
end

math.rad() converts a degree to a radian which is what the functions take as parameters

2 comments

0

ok thanks im pretty new to Cframe scripting

0

Np glad you're going at it

This discussion is preserved as it was. New answers, comments, and votes are closed.