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 the script, It's to do with Died:Connect(function()?

"Zombie" is the zombies in the game which is in workspace. "RealMoney" is made when game starts so is in the player and isn't in leaderstats . "CoinBoost" is made by pets it's a variable saved of how much extra coins pets give you. This Script is for when the Zombie dies and money is given plus the value the coin boost has.

local Zombie = game.Workspace.Zombie
local char = script.Parent.Parent
local plr = game.Players:GetPlayerFromCharacter(char)
local RealMoney = plr:FindFirstChild("RealMoney")
local boost = plr:FindFirstChild("CoinBoost")
            
Zombie:WaitForChild("Zombie").Died:Connect(function()
	plr.RealMoney.Value = plr.RealMoney.Value + 100 + boost.Value
	end)
	

1 comment

1

.Humanoid.Died

2 answers

✓ Accepted answer

The died event is only for the instance humanoid. This would work:

local Zombie = game.Workspace.Zombie
local char = script.Parent.Parent
local plr = game.Players:GetPlayerFromCharacter(char)
local RealMoney = plr:FindFirstChild("RealMoney")
local boost = plr:FindFirstChild("CoinBoost")

Zombie:WaitForChild("Zombie"):WaitForChild("Humanoid").Died:Connect(function()
	plr.RealMoney.Value = plr.RealMoney.Value + 100 + boost.Value
end)

The .Died event is for Humanoids, Please do more research before asking next time.

2 comments

0

he could have renamed the Humanoid to "Zombie"

0

Yh I did I said it

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