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 give money to all players when they kill a Zombie?

Hello, so I am making a game where we kill zombies, orignal, I know, but im gonna this one different, I won't explain how.

Anyways, here is the script that I have, ignore all of the other code, just focus on line 8-13

name="Humanoid"

robo=script.Parent:clone()

while true do
	wait(5)
	if script.Parent.Humanoid.Health<1 then
		game.Players:GetChildren()
		p = game.Players:GetChildren()

	for i = 1,#p do

	p[i].leaderstats.Cash.Value + 50

	end 
		robot=robo:clone()
		robot.Parent=script.Parent.Parent
		robot:makeJoints()
		script.Parent:remove()
	end
end
		


I'm new the :GetChildren() function, anyways nothing pops up in the output. what I'm trying to do is every time someone kills a zombie, every player is gonna get 50 dollars. Please help.

1 answer

✓ Accepted answer

p[i].leaderstats.Cash.Value + 50 is written wrong, it should be written p[i].leaderstats.Cash.Value = p[i].leaderstats.Cash.Value + 50

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