How to make a value a players username based on join time

let me explain, so
image
the values should always exist in workspace player 1 being the oldest player 6 being the newest and if there are only lets say 4 players. value Player5 and value Player6 should just have error in the string

(the values are string values) also the string in the value should be the players username

You could check when the player joins, if there are already players in the game [ and how many], and based on that, you could assign him a value and add a number at the end[the number could be the number of current amount of players [including him]

[Hope I understood you right]

well i already have this but instead of the value being in workspace its in the player instance and instead of the username it’s the number of position

local players = game:GetService("Players")

local function onPlayerAdded(player)
	local position = Instance.new("IntValue")
	position.Name = "Position"
	position.Value = #players:GetPlayers()
	position.Parent = player
end

local function onPlayerRemoving(player)
	local position = player.Position
	for _, _player in ipairs(players:GetPlayers()) do
		local _position = _player.Position
		if _position.Value > position.Value then
			_position.Value -= 1
		end
	end
end

players.PlayerAdded:Connect(onPlayerAdded)
players.PlayerRemoving:Connect(onPlayerRemoving)

First change the instanced value to a string value. After that change the value of that instance to the players name but name it their join position.

you don’t understand the values are in the workspace

Let me know if you want an example of the values updating when the players leave as well.

game.Players.PlayerAdded:Connect(function(plr)
	for _, v in ipairs(workspace.Folder:GetChildren()) do
		if v.Value == "" then
			v.Value = plr.Name
			break	
		end
	end
end)

this is what i have but im getting an error

local players = game:GetService("Players")
local function onPlayerAdded(player)
    local playerCount = #game.Players:GetPlayers()
    local playerinstance = "workspace.Player" .. playerCount
    print(playerinstance)
    local position = playerinstance
    print(position)
    position.Value = player.Name
    position.Parent = workspace
end

local function onPlayerRemoving(player)
    local playerinstance = "workspace.Player" .. playerCount
    local position = playerinstance
    for _, _player in ipairs(players:GetPlayers()) do
        local _position = _player.Position
        if _position.Value > position.Value then
            _position.Value -= 1
        end
    end
end

players.PlayerAdded:Connect(onPlayerAdded)
players.PlayerRemoving:Connect(onPlayerRemoving)

error:

attempt to index string with 'Value'

Which line is this error occurring? It seems like you’re trying to get the value of something that doesn’t have the value. Do you want this to be a string value?

yeah so what i think is happening is that on like 4 i make a string and apply that to the position and i think it’s registering as a string not a instance