Hello I am trying to link a script for money into a shop gui if anyone can tell me why this following script wont go into a shop gui please tell me why?
sp = script.Parent for _,v in pairs(sp:GetChildren()) do if v:IsA('Humanoid') then Humanoid = v end end
function Dead() local tag = Humanoid:findFirstChild("creator") if tag ~= nil then if tag.Value ~= nil then local Leaderstats = tag.Value:findFirstChild("leaderstats") if Leaderstats ~= nil then Leaderstats.Money.Value = Leaderstats.Money.Value + math.random(10,50) Leaderstats:FindFirstChild('Zombie Kills').Value = Leaderstats:FindFirstChild('Zombie Kills').Value + 1 wait(0.1) script:remove() end end end end
Humanoid.Died:connect(Dead) --~~~~~~~~~~~~~~~~~ --Put this script into the workspace --~~~~~~~~~~~~~~~ function onPlayerEntered(newPlayer) local stats = Instance.new("IntValue",newPlayer) stats.Name = "leaderstats"
local money = Instance.new("IntValue") money.Name = "Money" money.Value = 0 local zkills = Instance.new('IntValue') zkills.Name = 'Zombie Kills' zkills.Value = 0
money.Parent = stats zkills.Parent = stats end
game.Players.ChildAdded:connect(onPlayerEntered)
print("Leaderboards Loaded")
`
If you know why tell me plz?