so basically this is a stat script for a basketball game or whatever. So basically when a player joins a game its supposed to clone this frame and change the textlabel text to the players Name. That works fine but when a new player joins, on the person who joined the server previously it just clones it and doesnt change the name. For the new player it just says their name only (sorry im bad at explaining things)
-- Server Script --
game.Players.PlayerAdded:Connect(function(player)
local NewFolder = Instance.new("Folder")
NewFolder.Name = player.Name
NewFolder.Parent = game.Workspace:WaitForChild("Stat")
local PointsValue = Instance.new("NumberValue")
PointsValue.Value = 0
PointsValue.Parent = NewFolder
PointsValue.Name = "Points"
local AssistsValue = Instance.new("NumberValue")
AssistsValue.Value = 0
AssistsValue.Parent = NewFolder
AssistsValue.Name = "Assists"
local ReboundsValue = Instance.new("NumberValue")
ReboundsValue.Value = 0
ReboundsValue.Parent = NewFolder
ReboundsValue.Name = "Rebounds"
local StealsValue = Instance.new("NumberValue")
StealsValue.Value = 0
StealsValue.Parent = NewFolder
StealsValue.Name = "Steals"
local BlockValue = Instance.new("NumberValue")
BlockValue.Value = 0
BlockValue.Parent = NewFolder
BlockValue.Name = "Blocks"
game.ReplicatedStorage:WaitForChild("NameStat"):FireAllClients()
end)
-- Local Script --
local replicated = game:GetService("ReplicatedStorage")
replicated:WaitForChild("NameStat").OnClientEvent:Connect(function()
local frame = script.Parent.StatsClone.PlayerStats
local frameclone = frame:Clone()
frameclone.Parent = script.Parent.Home
frameclone.Visible = true
frameclone:WaitForChild("PlayerName").Text = game.Players.LocalPlayer.Name
end)

2 comments
Thx this works but when a new player joins it doesnt show the people that joined the server previously.
You could have a seperate function that gets all the players in Players service. You use a for-loop to go through all the players and create a new frameclone with their name. You could do this in the local script with a new remote event that handles that