Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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 :)

4 comments

0

What's going wrong with your script?

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

0

Are there any error messages in the output?

0

Nope

1 answer

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)

2 comments

0

The script has an error with the Else statement

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

This discussion is preserved as it was. New answers, comments, and votes are closed.