So when I press the Onbutton it Plays the song correctly, changes the color, and changes the PointLight but it’s only working on 1 Part instead of all the parts. Any solutions?
On-Script
function onClicked()
game.Workspace.Part.Part.Color = Color3.fromRGB(0, 0, 0)
game.Workspace.Alarms.Subscribe:Play()
game.Workspace.Part.Part.SurfaceLight.Color = Color3.fromRGB(255, 0, 0)
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
Off Script
function onClicked()
game.Workspace.Part.Part.Color = Color3.fromRGB(127, 127, 127)
game.Workspace.Alarms.Subscribe:Pause()
game.Workspace.Part.Part.SurfaceLight.Color = Color3.fromRGB(255, 255, 255)
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
workspace.Alarms.Subscribe:Play()
for i, Part in pairs(workspace:GetChildren()) do
if Part.Name == "Part" and Part:FindFirstChild'Part' then
Part.Part.Color = Color3.fromRGB(0, 0, 0)
Part.Part.SurfaceLight.Color = Color3.fromRGB(255, 0, 0)
end
end
function onClicked()
workspace.Alarms.Subscribe:Play()
for i, Part in pairs(workspace:GetChildren()) do
if Part.Name == "Part" and Part:FindFirstChild'Part' then
Part.Part.Color = Color3.fromRGB(0, 0, 0)
Part.Part.SurfaceLight.Color = Color3.fromRGB(255, 0, 0)
end
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
function onClicked()
workspace.Alarms.Subscribe:Play()
for i, Part in pairs(workspace.Lights:GetChildren()) do
if Part.Name == "Part" and Part:FindFirstChild'Part' then
Part.Part.Color = Color3.fromRGB(0, 0, 0)
Part.Part.SurfaceLight.Color = Color3.fromRGB(255, 0, 0)
end
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
OffButton
function onClicked()
workspace.Alarms.Subscribe:Play()
for i, Part in pairs(workspace.Lights:GetChildren()) do
if Part.Name == "Part" and Part:FindFirstChild'Part' then
Part.Part.Color = Color3.fromRGB(0, 0, 0)
Part.Part.SurfaceLight.Color = Color3.fromRGB(255, 0, 0)
end
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
for i, Part in pairs(workspace.Lights:GetChildren()) do
if Part.Name == "Part" then
Part.Color = Color3.fromRGB(0, 0, 0)
Part.SurfaceLight.Color = Color3.fromRGB(255, 0, 0)
end
end