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

how would you fix "not a valid member of Player"?

I am trying to make a roundbased game and it all works up until it looks for the value of a bool in the player called Won. I checked ingame and is definantly inside the player but for some reason the game sats it is not a valid memeber of player.

local status = game:GetService("ReplicatedStorage").Status

local games = game:GetService("ServerStorage").Games:GetChildren()

local lobbyMusic = workspace.Music.LobbyMusic

local gameMusic30 = workspace.Music.GameMusic30

local gameMusic60 = workspace.Music.GameMusic60

local countEffect = workspace.Music.CountEffect

  

while true do

wait(1)

i = 10

while i ~= -1 do

wait(1)

status.Value = "Intermission: "..i

i = i - 1

end

status.Value = "Selecting Game"

wait(5)

local rand = math.random(1,#games)

local chosenGame = games[rand]

local clone = chosenGame:Clone()

clone.Parent = workspace

status.Value = "Game Chosen: "..games[rand].Name

wait(3)

status.Value = "Teleporting"

wait(2)

status.Value = "Game In Progress"

local players = game.Players:GetChildren()

local points = clone.SpawnPoints:GetChildren()

for i,v in pairs(players) do

local gui = v.PlayerGui.Countdown

local char = v.Character

local rand = math.random(1,#points)

--if v:FindFirstChild("Loaded")then

gui.Timer.TextLabel.Text = chosenGame.GameTime.Value

char.HumanoidRootPart.CFrame = points[rand].CFrame

gui.Parent.Status.Base:TweenPosition(UDim2.new(0,0,-.5,0))

moduleMain = require(chosenGame.MainScript)

--end

end

for i,v in pairs(players) do

local gui = v.PlayerGui.Countdown

-- if v:FindFirstChild("Loaded") then

gui.StartingIn:TweenPosition(UDim2.new(0,0,0,0))

wait(1.5)

for i = 0, 5 do

wait()

lobbyMusic.Volume = lobbyMusic.Volume -.1

i = i + 1

end

gui.StartingIn:TweenPosition(UDim2.new(-1,0,0,0))

wait()

gui.Three:TweenPosition(UDim2.new(0,0,0,0))

countEffect:Play()

wait(1.5)

gui.Three:TweenPosition(UDim2.new(-1,0,0,0))

gui.Two:TweenPosition(UDim2.new(0,0,0,0))

countEffect:Play()

wait(1.5)

gui.Two:TweenPosition(UDim2.new(-1,0,0,0))

gui.One:TweenPosition(UDim2.new(0,0,0,0))

countEffect:Play()

wait(1.5)

gui.One:TweenPosition(UDim2.new(-1,0,0,0))

gui.Timer:TweenPosition(UDim2.new(.92,0,.1,0))

countEffect:Play()

wait()

--moduleMain.Main(v)

for i = chosenGame.GameTime.Value, 1,-1 do

wait(1)

status.Value = "Game In Progress: "..i - 1

gui.Timer.TextLabel.Text = i - 1

end

gui.GameOver:TweenPosition(UDim2.new(0,0,0,0))

wait(2.5)

gui.GameOver:TweenPosition(UDim2.new(-1,0,0,0))

status.Value = "Game Over"

for i = 0, 5 do

wait()

lobbyMusic.Volume = lobbyMusic.Volume + .1

i = i + 1

end

local winners = {}

for i,v in pairs(players)do

if v.Won == true then

winners[i] = v.Name

end

end

wait(2)

status.Value = "Winners Are: "..table.concat(winners,", ")

--end

end

end

3 comments

0

Shut up

0

I put the code in a code block.

0

For line 167. Use v:WaitForChild("Won" 5).Value == true then

1 answer

You might be mixing up the player with the character. Instead of doing

v.Won

to access the BoolValue, try doing

v.Character.Won

4 comments

0

Don't forget the .Value

0

I tried the character and it doesnt work

0

I said to access the BoolValue, not the value of the BoolValue.

0

@jakebball2014 Try printing v.Character to see if it's nil or not.

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