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 7 years ago
Edited 7 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 — 7y

4 answers

Log in to vote
1
Answered by
ScuffedAI 435 Moderation Voter
7 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.

01players = game.Players
02character = game.Players.Character
03 
04script.Parent.Touched:connect(function(hit)
05    for i, v in pairs(game.Players:GetPlayers()) do
06        inGame = v:FindFirstChild("InGame")
07        if inGame then
08            if inGame.Value == false then
09                if v.leaderstats.Points.Value >= 500 then
10                    v.leaderstats.Points.Value = v.leaderstats.Points.Value - 500
11 
12                    -- I'm guessing this is what you're trying to do.
13                    v.Character.Torso.Transparency = 1
14                end
15            end
16        end
17    end
18end)
0
It's a good idea to check for the player's character, and if it's a R6 rig. :) TheeDeathCaster 2368 — 7y
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 — 7y
Ad
Log in to vote
0
Answered by 7 years ago
01players = game.Players
02character = game.Players.LocalPlayer.Character
03 
04script.Parent.Touched:connect(function(hit)
05    for i, v in pairs(game.Players:GetPlayers()) do
06        inGame = v:FindFirstChild("InGame")
07        if inGame then
08            if inGame.Value == false then
09                if v.leaderstats.Points.Value >= 500 then
10                    v.leaderstats.Points.Value = v.leaderstats.Points.Value - 500
11                    game.players.character.Torso.Transparency = 1
12                end
13            end
14        end
15    end
16end)
0
Line 11 would still not work JinxedJord_n 15 — 7y
Log in to vote
0
Answered by 7 years ago
Edited 7 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 — 7y
Log in to vote
0
Answered by
Dorx86 0
7 years ago
Edited 7 years ago
1local Character = game.Players.LocalPlayer.Character:wait()

Answer this question