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

Why is this not working?

x = script.Parent

function clicked()
if script.Value.Value == 0 then
print("Click")
script.Value.Value = 1
for re = 1, 10 do -- What do I put in replace of 10?
	x.CFrame = x.CFrame *CFrame.Angles(0, 0.1, 0)
	wait(0.01)
end

script.Value.Value = 2
end

end


script.Parent.ClickDetector.MouseClick:connect(clicked)


function clicked2()
	if script.Value.Value == 2 then
print("Click")
script.Value.Value = 1
	for re = 1, 10 do -- What do I put in replace of 10?
	x.CFrame = x.CFrame *CFrame.Angles(0, 0.1, 0)
	wait(0.01)
	end
		script.Value.Value = 0
	end
	end

script.Parent.ClickDetector.MouseClick:connect(clicked2)

2 comments

0

I need it to turn 90 degrees

0

Output? Description of the script? Anything?

1 answer

✓ Accepted answer

First thing you are using two connections for the same event. And I am not sure why you have the same script twice? But this script will rotate the brick 90 degrees.

local Speed = 10 --Higher is slower
function clicked()
	for re = 1, Speed do 
   		script.Parent.CFrame = script.Parent.CFrame *CFrame.Angles(0, math.rad(90/Speed), 0)
    		wait(0.01)
	end
end

script.Parent.ClickDetector.MouseClick:connect(clicked)

1 comment

0

Thank you!

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