local values = workspace.Values
local gui = game:WaitForChild("StarterGui")
players = values:WaitForChild("Players")
local team1 = players:WaitForChild("Team1")
local team2 = players:WaitForChild("Team2")
local teamcaps = values:WaitForChild("Begin")
local teamcap1 = teamcaps:WaitForChild("teamcap1")
local teamcap2 = teamcaps:WaitForChild("teamcap2")
wait(1)
game.Players.PlayerAdded:connect(function(player)
if player:FindFirstChild("inhere") then
wait()
else
local d = Instance.new("ObjectValue")
d.Parent = player
d.Name = "inhere"
local s = Instance.new("NumberValue")
s.Parent = player
s.Name = "playernumber"
gui.Values:Clone().Parent = player
gui.Stats:Clone().Parent = player
wait()
if player.Team == game.Teams.Unselected then
if team1.Player1.Value~="" then
if team1.Player2.Value~="" then
if team1.Player3.Value~="" then
if team1.Player4.Value~="" then
if team2.Player1.Value~="" then
if team2.Player2.Value~="" then
if team2.Player3.Value~="" then
if team2.Player4.Value~="" then
wait(1)
else
team1.Player4.Value=player.Name
player.playernumber.Value=4
end
else
team1.Player3.Value=player.Name
player.playernumber.Value=3
end
else
team1.Player2.Value=player.Name
player.playernumber.Value=2
end
else
team1.Player1.Value=player.Name
player.playernumber.Value=1
teamcap1.Value = player.Name
end
elseif team1.Player4.Value == player.Name then
team2.Player4.Value=player.Name
player.playernumber.Value=4
end
elseif team1.Player3.Value == player.Name then
team2.Player3.Value=player.Name
player.playernumber.Value=3
end
elseif team1.Player2.Value == player.Name then
team2.Player2.Value=player.Name
player.playernumber.Value=2
end
elseif team1.Player1.Value == player.Name then
team2.Player1.Value=player.Name
player.playernumber.Value=1
teamcap2.Value = player.Name
end
end
end
end)
Whenever I test it, it won't fill the string value with the name.
-LukeGabrieI
[edit]
Original Code: (First code up above is server side, this one is a local script located in the startergui. I'm trying to make it so that it'll put the player's name when joining on one team.
PLAYERS=workspace.PLAYERS
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:wait()
gui=game.StarterGui
wait(1)
if player:FindFirstChild("inhere") then
wait()
else
local d=Instance.new("ObjectValue")
d.Parent=player
d.Name="inhere"
local s=Instance.new("NumberValue")
s.Parent=player
s.Name="playernumber"
gui.AllPoints:clone().Parent=player
gui.Points:clone().Parent=player
gui.ShotsA:clone().Parent=player
gui.ShotsM:clone().Parent=player
wait()
if player.TeamColor==BrickColor.new("Bright red") then
gui.Red:clone().Parent=char.Torso
if PLAYERS.RED.one.Value~="" then
if PLAYERS.RED.two.Value~="" then
if PLAYERS.RED.three.Value~="" then
if PLAYERS.RED.four.Value~="" then
if PLAYERS.RED.five.Value~="" then
wait(1)
else
PLAYERS.RED.five.Value=player.Name
player.playernumber.Value=5
end
else
PLAYERS.RED.four.Value=player.Name
player.playernumber.Value=4
end
else
PLAYERS.RED.three.Value=player.Name
player.playernumber.Value=3
end
else
PLAYERS.RED.two.Value=player.Name
player.playernumber.Value=2
end
else
PLAYERS.RED.one.Value=player.Name
player.playernumber.Value=1
end
elseif player.TeamColor==BrickColor.new("Bright blue") then
gui.Blue:Clone().Parent=char.Torso
if PLAYERS.BLUE.one.Value~="" then
if PLAYERS.BLUE.two.Value~="" then
if PLAYERS.BLUE.three.Value~="" then
if PLAYERS.BLUE.four.Value~="" then
if PLAYERS.BLUE.five.Value~="" then
wait()
else
PLAYERS.BLUE.five.Value=player.Name
player.playernumber.Value=5
end
else
PLAYERS.BLUE.four.Value=player.Name
player.playernumber.Value=4
end
else
PLAYERS.BLUE.three.Value=player.Name
player.playernumber.Value=3
end
else
PLAYERS.BLUE.two.Value=player.Name
player.playernumber.Value=2
end
else
PLAYERS.BLUE.one.Value=player.Name
player.playernumber.Value=1
end
end
end

4 comments
You know, maybe you'd solve this by yourself if you described more.
I wouldn't think people would read the jibber jabber and go straight to the code, lol. Basically I'm trying to have it so that if a player joins, they will take up a value, and when more people join, it's suppose to bypass the first value taken by the first person, and all the String Values will be full. But what I'm seeing is that when a corresponding player joins, they take up the first player's
String Value. So idk how I can fix it.
to turn object into a string it is tostring(objectpath)