Basically when i step on a part a sound will play inside the players PlayerGui and this works PERFECTLY in studio but when i go to the actual game when i step on the part it does not instance the sound in the PlayerGui help??
cooldown = 50--Put amount of seconds for cooldown to last.
db = false
script.Parent.Touched:connect(function(hit)
if db == false then
db = true
local sound50 = Instance.new("Sound", game.Players.LocalPlayer.PlayerGui)
sound50.Playing = "true"
sound50.SoundId = "rbxassetid://184219038"
wait(40)
sound50:Remove()
wait(cooldown)
db = false
end
end)

5 comments
it works now but it's constantly playing the music
This could be because your .Looped variable is set to true. Try setting the sound's .Looped to false.
No i mean its constantly instancing the music..
Nevermind i used another debounce and it works Thanks
Oh, I see what you mean. It was my fault, I forgot to add a debounce = true part in the script, my apologies! Anyway, glad it works for you! :)