This script is supposed to play a sound when touching a brick, while stopping other sounds
1 script.Parent.Touched:connect(function(hit)
2 if hit.Parent:FindFirstChild("Humanoid")then
3 game.Players[hit.Parent.Name].PlayerGui.Sound1.Volume = 1
4 game.Players[hit.Parent.Name].PlayerGui.Sound1:Play()
5 game.Players[hit.Parent.Name].PlayerGui.Sound2:Stop()
6 end
7 end)
However, when tested on roblox studio it works perfectly fine but when in the actual roblox game it fails to do anything.
I'm new to scripting so it's been a pain trying to figure out whats wrong with this script, please send help!

1 comment
Don't put the sound in PlayerGui