Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My script keeps thinking my space hat has a humanoid in it. how do i fix????

Asked by 6 years ago

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)
0
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 ,      iddash 45 — 6y
0
Hint just use remote functions to access player gui remote events can't access playergui Developer_Kai 11 — 6y
0
the game isn't FE Quackshire 17 — 6y
0
my gosh WHERE IS YOUR MONITOR LOCATED ON YOUR COMPUTER OR ROBLOX???? hiimgoodpack 2009 — 6y

Answer this question