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

Can I get help by associating parts that are clickable so that it starts operations (UNSOLVED)?

Asked by 8 years ago

I am wanting to associate a part that is for a washer that when you press it it starts rotating a drum. However I am not finding any solutions to it at all. Here is the script I have as of now- first is on the button for the washer (the button is not in GUI terms ~)

local state = false
local part = game.Workspace.Drum

button.MouseButton1Down:connect (function()
    if state == false then
        state = true
        button.Text = 'Washing'
        while wait(.01) do
            part.CFrame = part.CFrame * CFrame.Angles(math.rad(9), math.pi,math.rad(180))

        end




else
    button.Text = 'Start Washer'
    state = false
    end
end)

I am also wanting to know if there is a formula or function or anything that will help me time the rotation.

Please and Thank you :)

1 answer

Log in to vote
0
Answered by 8 years ago

ClickDetector objects are your friend here. You can connect to an event that fires when you click on a brick.

Ad

Answer this question