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)

4 comments
This is a FE issue, your gonna need to use remote events or functions. You cant access someones playergui from the client. You have to tell the server to do it. Here is the wiki page for it but im sur you can find some videos WIKI: http://wiki.roblox.com/index.php?title=Remote_Events_and_Functions ,
Hint just use remote functions to access player gui remote events can't access playergui
the game isn't FE
my gosh WHERE IS YOUR MONITOR LOCATED ON YOUR COMPUTER OR ROBLOX????