Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make this player to server storage?

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

✓ Accepted answer

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

1 comment

0

Update:This works!

This discussion is preserved as it was. New answers, comments, and votes are closed.