Hello there, I have a complicated situation here where I want to make a StringValue change it's value to the player's name that joined, I don't really know on how to approach this because I can only think of all of the StringValues copying the player's name that joined instead of one player only for one StringValue only
I also want to do this for the second player that joins the server, where the second StringValue changes it's value to the second player's name that joined the server, also occuring with the other 4 StringValues, how does one do this?
local Players = game:GetService("Players") local plr1 = game.Workspace.PlayerStrings.Player1 local plr2 = game.Workspace.PlayerStrings.Player2 local plr3 = game.Workspace.PlayerStrings.Player3 local plr4 = game.Workspace.PlayerStrings.Player4 local plr5 = game.Workspace.PlayerStrings.Player5 local plr6 = game.Workspace.PlayerStrings.Player6 local function onPlayerAdded(player) plr1.Value = player.Name plr2.Value = player.Name plr3.Value = player.Name plr4.Value = player.Name plr5.Value = player.Name plr6.Value = player.Name end for _, player in pairs(Players:GetPlayers()) do onPlayerAdded(player) end Players.PlayerAdded:Connect(onPlayerAdded)
local Players = game:GetService("Players") local PlayerStrings = game.Workspace.PlayerStrings Players.PlayerAdded:Connect(function() for i, plr in pairs(Players:GetPlayers()) do local plrName = Instance.new("StringValue",PlayerStrings) --creating a stringValue under the folder for each player plrName.Name = ("Player"..i) --naming the playerString plrName.Value = plr.Name --setting the playerString value to player's name end end)
im not sure if i 100% understand ur post but this script, although a little inefficient is the best simple solution i could think of. so u want to have a empty folder under ur workspace named "PlayerStrings" and this script will create a string value for each player that joins and it will place it under the folder.