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

What is wrong with this line of code and why is no problems outputted?

This is for when the zombie called "Humaniod" dies and cash is given to the player

game:GetService('Players').PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		character:WaitForChild("Humanoid").Died:Connect(function()
			player.RealMoney.Value = player.RealMoney.Value + 1000
		end)
	end)
end)

2 comments

0

Is RealMoney inside leaderstats?

0

No leaderstats is made when the game is started

1 answer

✓ Accepted answer

Because the script itself doesn't have any problems, it should work just fine. The problem is that the script is not told to do anything when a zombie dies. Instead, what the script is told to do is whenever a player dies, the player that dies is given money. If you want a player to be given money when they kill a zombie then you should have a script in the zombie that waits for the zombie to die then gives the player who last damaged it money.

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