Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is this not working?

Asked by
mnaj22 44
9 years ago
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)
0
I need it to turn 90 degrees mnaj22 44 — 9y
0
Output? Description of the script? Anything? NotsoPenguin 705 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

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)
0
Thank you! mnaj22 44 — 9y
Ad

Answer this question