script.Parent.ClickDetector.MouseClick:connect(onClicked) function onClicked() Game.Workspace.UX1.BrickColor = BrickColor.new("Really red") end script.Parent.ClickDetector.MouseClick:connect(onClicked) function onClicked() Game.Workspace.LX1.BrickColor = BrickColor.new("Really red") end script.Parent.ClickDetector.MouseClick:connect(onClicked) function onClicked() Game.Workspace.NAME1.BrickColor = BrickColor.new("Really red") end script.Parent.ClickDetector.MouseClick:connect(onClicked) function onClicked() local s = Instance.new("Sound") s.Parent = game.Workspace s.SoundId = "http://www.roblox.com/asset/?id=922451844" s.Pitch = 1 s:play() wait(1.306) s:Stop() s:remove() end script.Parent.ClickDetector.MouseClick:connect (onClicked)
I am trying to make a talent show panel, this is the script I used, the sound plays but the brick color will not change.
This works put a clickdetector inside the part and this in a script
function onClicked() local s = Instance.new("Sound") game.Workspace.Part.BrickColor = BrickColor.new("Really red") s.Parent = game.Workspace s.SoundId = "http://www.roblox.com/asset/?id=922451844" s.Pitch = 1 s:play() wait(1.306) game.Workspace.Part.BrickColor = BrickColor.new("Brick yellow") s:Stop() s:remove() end script.Parent.ClickDetector.MouseClick:connect(onClicked)
script.Parent.ClickDetector.MouseClick:connect(function() game.Workspace.UX1.BrickColor = BrickColor.new("Really red") game.Workspace.LX1.BrickColor = BrickColor.new("Really red") game.Workspace.NAME1.BrickColor = BrickColor.new("Really red") local s = Instance.new("Sound") s.Parent = game.Workspace s.SoundId = "http://www.roblox.com/asset/?id=922451844" s.Pitch = 1 s:play() wait(1.306) s:Stop() s:remove() end)
This should work, your problem was Game needs a lowercase g, you also don't have to define the click detector multiple time or call the function multiple times.