Here is the issue:
I have a local script inside of StarterPlayerScripts that is basically a team assigner.
Code:
local number = math.random(1,2)
local blue = game.Teams.Blue
local red = game.Teams.Red
local redamount = game.Teams.Red.Value.Value
local blueamount = game.Teams.Blue.Value.Value
local player = game.Players.LocalPlayer
local team = “unknown”
if number == 1 then
if blueamount < redamount then
player.Team = blue
team = “blue”
player.Neutral = false
blueamount = blueamount + 1
elseif blueamount == redamount then
player.Team = blue
team = “blue”
player.Neutral = false
blueamount = blueamount + 1
elseif redamount < blueamount then
player.Team = red
team = “red”
player.Neutral = false
redamount = redamount + 1
end
end
if number == 2 then
if redamount < blueamount then
player.Team = red
team = “red”
player.Neutral = false
redamount = redamount + 1
elseif redamount == blueamount then
player.Team = red
team = “red”
player.Neutral = false
redamount = redamount + 1
elseif blueamount < redamount then
player.Team = blue
team = “blue”
player.Neutral = false
blueamount = blueamount + 1
end
end
if player.PlayerRemoving then
if team == “blue” then
blueamount = blueamount - 1
elseif team == “red” then
redamount = redamount - 1
end
end
(copy and pasted, sorry about it having no code blocks / spaces, it’s an eye sore for sure)
The part of the script on where I want to focus is the last piece of code.
if player.PlayerRemoving then
if team == “blue” then
blueamount = blueamount - 1
elseif team == “red” then
redamount = redamount - 1
end
end
The part of the code that does not work is player.PlayerRemoving.
I don’t know why, but it says in the output when I test the script within studio that
"PlayerRemoving is not a valid member of Player “Players.F1ghtOn” even though it is clearly stated as an event of a player within ROBLOX API Players | Roblox Creator Documentation
Should I change it to Players.PlayerRemoving instead of player.PlayerRemoving /
( game.Players.LocalPlayer.PlayerRemoving )?