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

Brick color doesn't change?

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.

2 comments

0

is there an output? You can also condense this, you don't need multiple functions

0

F r e e c o d e i s f r e a k c o d e

2 answers

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.

1 comment

0

who put minus one on your answer, but its correct...

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