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

Audio won't play?

Asked by 9 years ago

Apparently I've forgotten how this works.



local song = math.random(1,5) function onClick(Player) if song == 1 or song == 2 or song == 3 then script.Parent.leedle:Play() else if song == 4 then script.Parent.leedlefox:Play() else if song == 5 or song == 6 or song == 7 or song == 8 then script.Parent.bonusducks:Play() else if song == 9 then script.Parent.lucy:Play() else if song == 9 then script.Parent.boss:Play() end end end end end end script.Parent.ClickDetector.MouseClick:connect(onClick)

Error being play isn't a valid member of script? What's weird is, using another sound that i already used before it works, but changing the Sound ID's broke it?

What confuses me, is that though that doesn't work, this does:

local Gate = workspace.Gate




function onClick(Player)
script.Parent.Zap:play()
if script.Parent.Reflectance == 1 and Player.Character.Humanoid.Health > 0 and Player.TeamColor == BrickColor.new("Camo") then
Gate.Transparency = 1
Gate.CanCollide = false
Gate.Enabled.Value = false

wait (10)
Gate.Enabled.Value = true
else
Player.Character.Humanoid.Health = 0 



end
end
script.Parent.ClickDetector.MouseClick:connect(onClick)

Answer this question