Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make this player to server storage?

Asked by 3 years ago

I want to make a clone of all the player's names with string values in server storage, but I don't know why this attempt won't work:

        if roundCount() == 10 then
            if #game.Players:GetChildren() < 2 then
                roundmes:FireAllClients('insufficent player count')

            else if #game.Players:GetChildren() > 2 then
                    print('test2')
                    for i,v in pairs(game.Players:GetChildren()) do
                        local xx = Instance.new("StringValue")
                        xx.Name = tostring(v.Name)
                        xx.Parent = alivePlayers
                    end
                    for i,v in pairs(workspace._:GetChildren()) do

                    end
                end

            end
        end

xx is the instance string with the player's name in server storage

This isn't working

1 answer

Log in to vote
1
Answered by 3 years ago

Try having somebody refactor it for you, or attempt to use WaitForChild to see if an object's not loading in.

if roundCount() == 10 then
    if table.getn(game:GetService("Players"):GetPlayers()) < 2 then
        roundmes:FireAllClients("Not enough players.")
    else
        for index, value in pairs(game:GetService("Players"):GetPlayers()) do
            local StringValue: StringValue = Instance.new("StringValue")
            StringValue.Name = value.Name
            StringValue.Parent = alivePlayers or game:GetService("ServerStorage"):WaitForChild("alivePlayers")
        end
        for index, value in pairs(workspace:WaitForChild("_", 5):GetChildren()) do

        end
    end
end
0
Update:This works! BIueIay 6 — 3y
Ad

Answer this question