I have a server script and a local script. The Server script reacts to a fired server event then loops through a folder in ReplicatedStorage with 16 string values called Claim_A, Claim_B, etc. If the value is empty, the player's name will be entered in the value and the loop will break and will fire a remote event back at all clients.
The local script is a for loop that will create the function where if one of the values change, it will find the frame inside ClaimFrame with the same name as itself.
The problem is that it starts on the wrong frame.
server script
Claim.OnServerEvent:Connect(function(Player) print("we got it boys") for i,v in pairs(Claims:GetChildren())do print(v) if v.Value == "" then--if its nothing v.Value = Player.Name print(Player.Name,"is",Claims[v.Name]) break end end end)
local script
for i,v in pairs(Claims:GetChildren()) do v.Changed:Connect(function() if v.Value ~= "" then --if its not nothing ClaimFrame[v.Name].Username.Text = v.Value ClaimFrame[v.Name].Visible = true game.SoundService.Bonk:Play() end end) end
Looping through a model or object is not guaranteed for it to go in order because of how the explorer it setup. One method is using a table and iterating through it.