Hey, anyone who is reading this
I've been making a script but only the playeradded seems to work and not remove, if anyone could help that would be nice.
--Get the workspaces player folder so we can later on set values to clone player-- local player_folders = game.Workspace:WaitForChild("Players") -- -- --Get each individual player object value-- local player1 = player_folders:WaitForChild("Player1") local player2 = player_folders:WaitForChild("Player2") local player3 = player_folders:WaitForChild("Player3") -- -- --Set the value to an entered player, if a value is free-- game.Players.PlayerAdded:connect(function(plr) plr.CharacterAdded:connect(function(char) wait(0.5) if player1.Value == nil then player1.Value = char elseif player2.Value == nil then player2.Value = char elseif player3.Value == nil then player3.Value = char end end) end) -- -- game.Players.PlayerRemoving:connect(function(plr) wait(0.5) if player1.Value == plr.Character then player1.Value = nil elseif player2.Value == plr.Character then player2.Value = nil elseif player3.Value == plr.Character then player3.Value = nil end end)
Thanks to anyone who can help!
if player1.Value == plr.Character then player1.Value = nil elseif player2.Value == plr.Character then player2.Value = nil elseif player3.Value == plr.Character then player3.Value = nil end
It's not ever going to find the right conditions. The player's character no longer exists, once they leave. Therefore, it'd probably be a better idea to do something like if player1.Value.Name == plr.Name then
. I'm sorry if I missed anything, but the main idea is you can't search for the character.