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

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

Asked by 6 years ago
Edited 6 years ago

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

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... Axceed_Xlr 380 — 6y

4 answers

Log in to vote
1
Answered by
ScuffedAI 435 Moderation Voter
6 years ago

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)
0
It's a good idea to check for the player's character, and if it's a R6 rig. :) TheeDeathCaster 2368 — 6y
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 CrimsonFlux 6 — 6y
Ad
Log in to vote
0
Answered by 6 years ago
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)
0
Line 11 would still not work JinxedJord_n 15 — 6y
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

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)

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 CrimsonFlux 6 — 6y
Log in to vote
0
Answered by
Dorx86 0
6 years ago
Edited 6 years ago
local Character = game.Players.LocalPlayer.Character:wait()

Answer this question