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

So I have a button on a washing machine and I was wondering if someone can help me to where once you press start it starts turning the drum. Here is the script. Maybe this will help. I am planning on tying this script that controls how another part acts. Also I was wondering would I need to add a Click detector to the part as well? If so do I also put the script in the Clickdetector? I plan on having FE on so that everyone doesn't know that the washer started.

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

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

    end
end)

Please and Thank you :)

0
What's going wrong with your script? iconmaster 301 — 8y
0
Well I am wanting to when I press the button, It starts the rotation of the drum and have some text on the button so when you click it , it says washing and if you dont click it, it says Start washer. And none of that is happening sammy52520 45 — 8y
0
Are there any error messages in the output? iconmaster 301 — 8y
0
Nope sammy52520 45 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago
local state = false
local part = game.Workspace.Drum


button.MouseButon1Down: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
    end

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

    end
end)

0
The script has an error with the Else statement sammy52520 45 — 8y
0
This script has not worked either. I was hoping for something that you can click and then it starts the rotation and it is just not happening sammy52520 45 — 8y
Ad

Answer this question