Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

"Character is not a valid member of Players" How do I fix this?

Don't worry, I fixed it my self

It's cause the game is R15 only and I tried using Torso instead of UpperTorso lol

1 comment

0

I had the same problems while working with UI teleport script. I later figured out that I kept referring players as game's Object. Maybe that is the case here too....Not too sure...

4 answers

✓ Accepted answer

Its because you're trying to access the character of Game.Players. Game.Players is not a player but something that has all the players inside of it. If you want to get someones char then you gotta be more specific and have a username after it.


players = game.Players
character = game.Players.Character

script.Parent.Touched:connect(function(hit)
    for i, v in pairs(game.Players:GetPlayers()) do
        inGame = v:FindFirstChild("InGame")
        if inGame then
            if inGame.Value == false then
                if v.leaderstats.Points.Value >= 500 then
                    v.leaderstats.Points.Value = v.leaderstats.Points.Value - 500

                    -- I'm guessing this is what you're trying to do.
                    v.Character.Torso.Transparency = 1
                end
            end
        end
    end
end)

2 comments

0

It's a good idea to check for the player's character, and if it's a R6 rig. :)

0

Hi this is CrimsonFlux, thank you for answer, but I know why it wasn't working, even trying your script didn't work, I found out the error. It's because Torso is for R6 Characters, but UpperTorso, LowerTorso and stuff is for R15, so I tried that and it worked, but thank you for your answer :P

players = game.Players
character = game.Players.LocalPlayer.Character

script.Parent.Touched:connect(function(hit)
    for i, v in pairs(game.Players:GetPlayers()) do
        inGame = v:FindFirstChild("InGame")
        if inGame then
            if inGame.Value == false then
                if v.leaderstats.Points.Value >= 500 then
                    v.leaderstats.Points.Value = v.leaderstats.Points.Value - 500
                    game.players.character.Torso.Transparency = 1
                end
            end
        end
    end
end)

1 comment

0

Line 11 would still not work

I dont use the "for" command that way but i know what is wrong you're trying to access "character" in players

(also make sure its r6 your current problem isnt that but it will help)

1 comment

0

Hi this is CrimsonFlux, thank you for answer, but I know why it wasn't working, even trying your script didn't work, I found out the error. It's because Torso is for R6 Characters, but UpperTorso, LowerTorso and stuff is for R15, so I tried that and it worked, but thank you for your answer :P

local Character = game.Players.LocalPlayer.Character:wait()

This discussion is preserved as it was. New answers, comments, and votes are closed.