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

Brick color doesn't change?

Asked by 4 years ago
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.

0
is there an output? You can also condense this, you don't need multiple functions Twenty1chickens 4 — 4y
0
F r e e c o d e i s f r e a k c o d e Ziffixture 6913 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago

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)
Ad
Log in to vote
-1
Answered by 4 years ago
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.

0
who put minus one on your answer, but its correct... CedCed6 32 — 4y

Answer this question