I asked this question on the forums, but I got little to no help on the issue, so I thought I'd try here for help (and I was also told the ROBLOX Scripters forum is a little toxic).
So basically, when the player touches a brick (or in this case the UpperTorso of an R15 AI NPC) the brick kills them (which I have down) but the problem arises when the player dies, a ScreenGUI and a sound (which loops and is already configured in the sound) is supposed to play. But for some reason it doesn't show up or play any sound whatsoever. I hope someone can understand this issue lol. Thanks in advance for anyone who helps :D
local sound = script.ScreenGui.Sound local picture = script.ScreenGui.ImageLabel function onTouched(hitted) local human = hitted.Parent:findFirstChild("Humanoid") if human.Health == 0 then local p = game.Players:GetPlayersFromCharacter(hitted) local sound = p.PlayerGui.ScreenGui.Sound local picture = p.PlayerGui.ScreenGui.ImageLabel picture.Visible = true sound:Play() wait(8) picture.Visible = false sound:Stop() end end script.Parent.Touched:connect(onTouched)
"hitted" is the part that touched the brick. so to access the character just do hitted.Parent
local p = game.Players:GetPlayersFromCharacter(hitted.Parent)