I made a script that's supposed to play music once they enter the brick and I even made the object hitting it have a humanoid in it yet it still keeps spamming the console with "Space Hat is not a valid member of players" And the song keeps restarting even though i made it not play it again if it's already playing. Heres my code so far:
script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then if game.Players[hit.Parent.Name].PlayerGui.Audios.L1.Playing == false then game.Players[hit.Parent.Name].PlayerGui.Audios.L1:Play() else return end elseif not hit.Parent:FindFirstChild("Humanoid") then return else return end end) script.Parent.TouchEnded:connect(function(hit) game.Players[hit.Parent.Name].PlayerGui.Audios.L1:Stop() end)