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)
• Firstly, the second argument of Instance.new
was deprecated, therefore it may be wonky and not preform the anticipated job.
• Secondly, a Sound will only play in a physical environment - workspace
These are mostly the issues that will be causing the kerfuffle you’re experiencing. The solutions are quite easy:
local Sound = Instance.new("Sound")
Sound.Parent = workspace