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

How do i disable a material changing script using another click detector in a different part?

I just started scripting last week and im trying to make a brick thats flashing neon red turn to "Institutional white" and stop flashing after the click detector is clicked.

Here is the click detector script. Its not in the same group as the neon flashing red brick.

local cd = script.Parent
local light = game.Workspace.WarningLight
local Button = game.Workspace.Button.Buttn
cd.MouseHoverEnter:Connect(function()
	light.Transparency = 0.3
	Button.BrickColor = BrickColor.new ("Bright red")
end)
cd.MouseHoverLeave:Connect(function()
	light.Transparency = 0
	Button.BrickColor = BrickColor.new ("Institutional white")
end)
cd.MouseClick:Connect(function()
	light.BrickColor = BrickColor.new ("Institutional white")
end)

Here is the flashing red neon brick script

local part = script.Parent
while true do
	wait(2)
	part.Material = Enum.Material.SmoothPlastic
	wait(2)
	part.Material = Enum.Material.Neon
end

2 comments

0

Is the click detector in a part, if not it will not run, because you need a part to click on.

0

its in a part, it works but i need to figure out how to disable the second script when the button is pressed

1 answer

✓ Accepted answer

If you want to disable scripts from within a script you can use script.Disabled = true to disable it and script.Disabled = false to enable it.

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