How to make my bunny turn?

while true do
	wait(5)
	local ez = math.random(1,4)
	if ez == 1 then
		script.Parent.Parent.Orientation = Vector3.new(0,90,0)
	end
	if ez == 2 then
		script.Parent.Parent.Orientation = Vector3.new(0,0,0)
	end
	if ez == 3 then
		script.Parent.Parent.Orientation = Vector3.new(0,180,0)
	end
	if ez == 4 then
		script.Parent.Parent.Orientation = Vector3.new(0,-90,0)
	end
end

Now let me explain, I have this bunny that is supposed to just run around.
But I cant make the entire model turn? (It runs in random directions.)
Yes, it has a primary part.
NOTE: I found solution, used pivot instead. If you wanna use the model in your games, as long as you give a small amount of credit you can use. Bunny V3 - Roblox

1 Like

Use Model:SetPrimaryPartCFrame, and inside of the brackets, you’d use:

CFrame.Angles(0, math.rad(0), 0) --the Y axis should be the numbers you mentioned.
1 Like

Wouldnt math.rad randomize the directions? I’m trying to have it run in a straight X and Z pattern.

math.rad() basically gives the number in radians (degrees).

So would it be like

Script.Parent.Orientation = CFrame.Angles(0, math.rad(0), 0)
local rotations = {-90, 0, 90, 180}

while wait(5) do
    local rotation = rotations[math.random(1, #rotations)]
    script.Parent.Parent:SetPrimartyPartCFrame(CFrame.Angles(0, math.rad(rotation), 0))
end

It wont stop saying that it needs an End and a ) to close do. but when I add an End it doesnt work.

Heres code im using

local rotations = {-90, 0, 90, 180}

while wait(5) do
	local rotation = rotations[math.random(1, #rotations)]
	script.Parent.Parent:SetPrimartyPartCFrame(CFrame.Angles(0, math.rad(rotation), 0)
end end)

Nvm it fixed! Thank you, I just had to add an ) at the 2nd to last line.

Reminder - I do not suggest using :SetPrimaryPartCFrame() and for you to convert to :PivotTo() as :SetPrimaryPartCFrame() is going to be marked as deprecated by the end of the year.

This is kinda all foreign to me.
I’ll search up on it, thanks.

Hey! This doesnt work, instead my bunny just teleports across the map, it does change its orientation but it teleports.
Keep in mind this is combined with a simple cframe script.

local rotations = {-90, 0, 90, 180}

while wait(3) do

local rotation = rotations[math.random(1, #rotations)]

script.Parent:PivotTo(script.Parent:GetPivot() * CFrame.Angles(0, math.rad(rotation), 0))

end

PS: Fixed, it didnt have a primary part.

1 Like

Keep in mind, The :GetPivot() returns the orientation of the pivot point. You can modify that through these buttons on your “Model” tab on the top bar.

image