I am making a game where (once a button is pressed) a series of lanterns are released into the air.
Part of this is taking "LIGHT" which is an audio snipit inside "StarterGui" and making it play as the lanterns are floating up.
I think it has to do with how my script is NOT local, but the music needs to be played locally.
Here is my code:
**local light = game.StarterGui.LIGHT**
script.Parent.ClickDetector.MouseClick:connect(function()
script.Parent.Transparency = 1
local la = game.Workspace.Lanterns
local lag = la:GetChildren()
for _,v in pairs (lag) do
spawn(function()
if v.Name == "LanternAtt" then
local attA = v:FindFirstChild("AttachmentA")
if attA then
local at = attA:FindFirstChild("Attachment")
if at then
**light:Play()**
at:Destroy()
end
end
end
end)
end
wait(100)
for _,v in pairs (lag) do
v:Destroy()
end
end)

3 comments
Looks like you were a few seconds faster haha
@Asceylos ;p i type fast
Thank you @DanzLua and @Asceylos, both answers make great sense!