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

How to make a switch that makes object roll when on?

Asked by 5 years ago

asked once, didn't got good enough answer. here is the script:

local rolling = false
local roller = script.Parent.Parent.Roller

local function on()
    rolling = true
end

local function off()
    rolling = false
end

while rolling == true do
    roller.CFrame = roller.CFrame * CFrame.fromEulerAnglesXYZ(.4,0,0)
end


local function Click()
    if rolling == false then on() else off() end
end

script.Parent.ClickDetector.MouseClick:Connect(Click)

any help appreciated :)

Answer this question