So I have a part that would suppose to make a instance.new sound and would play. But for some reason, the instance.new sound wouldn't be in the PlayerGui or really, anywhere. Let me know anything I did wrong.
Script:
trigger = script.Parent
debounce = false
trigger.Touched:Connect(function(hit)
if not debounce then
debounce = true
local sound = Instance.new("Sound", game.Players[hit.Parent.Name].PlayerGui)
sound.SoundId = "rbxassetid://333430981"
sound.Volume = 3
sound.Looped = true
sound.Name = "Glitch"
game.Players[hit.Parent.Name].PlayerGui.Glitch:Play()
end
end)

3 comments
Why are you parenting it to the PlayerGui? Why not their character or something ?
Would it make a difference? Cause i'm new to scripting
Make sure you are using a local script for PlayerGui