Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-2

How would i make it if you die you drop money?

Asked by 10 years ago

Would this work? or not?


for i,v in pairs(game.Players:GetChildren()) do if v.Health == 0 then a = game.Lighting.Money:clone() a.Main.CFrame = v.Charecter.Head.CFrame a.Main.Money.Value = v.leaderstatus.Money.Value a.Parent = game.Workspace end end
0
You just asked the same question before. Please do not spam your questions. AmericanStripes 610 — 10y

2 answers

Log in to vote
0
Answered by
TheMyrco 375 Moderation Voter
10 years ago
game:GetService("Players").PlayerAdded:connect(function(p)
    p.CharacterAdded:connect(function(c)
        local hum = c:WaitForChild("Humanoid")
        hum.Died:connect(function()
            local a = game.Lighting.Money:Clone()
            a.Main.CFrame = c.Head.CFrame
            a.Main.Money.Value = p.leaderstats.Money.Value
            a.Parent = Workspace
        end)
    end)
end)

Ad
Log in to vote
0
Answered by 10 years ago

Try this.

for i,v in pairs(game.Players:GetChildren()) do
    v.Character.Humanoid.Died:connect(function()
        a = game.Lighting.Money:clone()
        a.Main.CFrame = v.Character.Head.CFrame
        a.Main.Money.Value = v.leaderstats.Money.Value
        a.Parent = Workspace
    end)
end

Answer this question