I have a part, Gamers, that I add StringValues to in a script. The StringValue.Name and Value are set to a player name. However, when I get the children of the Gamers part and attempt to iterate the string values all I get are StringValue.Name = 'Value' and StringValue.Value = 'Value'. Below is some sample code:
local gamers = game.Workspace.Gamers:GetChildren() for i = 1, #gamers do print("the string", gamers[i], gamers[i].Name, gamers[i].Value) end
The above code just prints: "the string Value Value"
Any idea what's going on?
There are a couple possibilities:
print
statements at various points in your scripts to determine what is and isn't working. If this doesn't help, you'll probably need to post the script.An example of a server-side script that might do what you want:
local gamers = workspace.Gamers:GetChildren() game.Players.PlayerAdded:Connect(function(player) local value = Instance.new("StringValue") value.Name = player.Name value.Value = player.Name value.Parent = gamers player.AncestryChanged:Connect(function() -- Occurs when the player leaves the game value:Destroy() end) end)