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

The money giving part (line 8)doesnt work. How can i solve it ?

local mapstoragechild = game.Workspace.MapStorage:GetChildren()
local players = game.Players:GetPlayers()
local message = game.Workspace.Message
local rp = game.Workspace.MapStorage.Map.PlayerStorage:GetChildren()
local rpp = rp:GetPlayerFromCharacter()
function tpbak()
	rp.Humanoid.Health.Value = 0
	rpp.leaderstats.Money.Value = rpp.leaderstats.Money.Value + 10
end
while #mapstoragechild == 1 do
	if #game.Workspace.MapStorage.Map.PlayerStorage:GetChildren() == 1 then
		tpbak()
		wait(2)
		game.Workspace.MapStorage:ClearAllChildren()
		script.Parent.Gameselect.Disabled = true
		wait(3)
		script.Parent.Intermission.Disabled = false
		game.Workspace.Gamemode.Value = 0
		message.Value = "Game Ended !"
		game.Workspace.Songs.Songloop.Disabled = false
		wait(1)
		script.Parent.Gameselect.Disabled = false
		script.Disabled = true
		break
	end
	wait(0.1)
end
-- It gives 10 money when you are only one left and kills

1 answer

GetChildren() Returns an array, you will have to loop throught every player, or just copy my script

function tpbak()
	for _, Character in pairs(rp) do
		local PlayerFromCharacter = game.Players:GetPlayerFromCharacter(Character)
		local PlayersMoney = PlayerFromCharacter.leaderstats.Money
		Character.Humanoid.Health = 0
		PlayersMoney.Value = PlayersMoney.Value + 10
	end
end

1 comment

0

So i cant select a one player by :GetChildren()

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