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

I keep gettng error player is not a valid member of players?

Asked by 7 years ago
script.Parent.Touched:connect(function(part)
    if part.Parent and Game:GetService('Players'):GetPlayerFromCharacter(part.Parent) then
        local player = Game:GetService('Players'):GetPlayerFromCharacter(part.Parent)
        print (player)
        if player:GetRankInGroup(3193777) >= 3 then
            script.Parent.Decal.Transparency = 0
            script.Parent.Transparency = 1
            script.Parent.CanCollide = false
            wait(0.8)
            script.Parent.Decal.Transparency = 1
            script.Parent.Transparency = 1
            script.Parent.CanCollide = true
            game.Lighting.TickGUI:Clone().Parent = game.Players["player"].PlayerGui
        end
    end
end)

00:48:59.546 - player is not a valid member of Players

??????

1 answer

Log in to vote
1
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
7 years ago

game.Players["player"] is looking for a Player in Players with the name "player"... it's not actually making use of your variable. It's looking for a name.

Just use your variable directly, like what you did on line 5. player.PlayerGui

Ad

Answer this question