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

Why is this randomly rotating?

		for i = 0,math.random(45,90) do
			print(i)
			game:GetService('RunService').RenderStepped:wait()
			model:SetPrimaryPartCFrame(model.PrimaryPart.CFrame*CFrame.Angles(math.rad(i),math.pi,math.rad(i)))
		end

I'm trying to smoothly rotate this model i have but when I try it randomly rotates

https://gyazo.com/a41b9fd08432945838d082f3439c5288 this is what happens

7 comments

0

yeah the whole code wont even copy and paste ?????

0

Link doesn't work. Make sure you're giving it a title if you use the link element in the textbox.

0

Is the object cancollided?

0

no the objects in the model cancollide property are set to false

0

here's the line that was cut off: "model:SetPrimaryPartCFrame(model.PrimaryPart.CFrame*CFrame.Angles(math.rad(i),math.pi,math.rad(i)))"

0

try for i =0,math.random(45,90),0.1 do  

0

did the same thing just slower

1 answer

local RenderStepped = game:GetService('RunService').RenderStepped

while RenderStepped:wait() do
    local Angle = math.random(45,90)

        print(i)   		  

        model:SetPrimaryPartCFrame(model.PrimaryPart.CFrame
        *CFrame.Angles(math.rad(Angle),math.pi,math.rad(Angle)))

end

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