Simply said my current script looks something like this
local rolling = true local parent = script.Parent local function on() rolling = false end local function off() washing = true end if washing == true then parent.Parent.Roller.CFrame = parent.Parent.Roller.CFrame * CFrame.fromEulerAnglesXYZ(.4,0,0) wait() else parent.Parent.Roller.CFrame = parent.Parent.Roller.CFrame * CFrame.fromEulerAnglesXYZ(0,0,0) end local function Click() if washing == true then off() else on() end end parent.ClickDetector.MouseClick:connect(Click)
still it doesn't works... I don't usually script, mostly building but wanted to make some functional buildings so need to face my weakness now. someone help :p
Alright so based on your limited information this is what I've got. I removed washing and just have it using rolling as your bool since I don't know what washing is or what its there for. I fixed the on/off and the click function so it will change back and forth correctly, i'd highly recommend using a debounce but again since I don't know all the details I wont force one into the script. Your if statement wouldn't work so I added a while loop in place, it likely wont work either as it stands but again, without knowing how and what you're doing this is the best I can do.
EDIT: I reread your question and edited out a couple lines of the while loop. If you want it to rotate while "on" and not while "off" then we don't need to tell it "don't rotate", we just don't rotate it.
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 parent.ClickDetector.MouseClick:Connect(Click)