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

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

Asked by 4 years ago

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

0
Is the click detector in a part, if not it will not run, because you need a part to click on. NathanBlox_Studios 212 — 4y
0
its in a part, it works but i need to figure out how to disable the second script when the button is pressed gpp_CSRO 4 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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.

Ad

Answer this question