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

How do I make cash drop when someone dies?

Asked by 7 years ago

How do I make cash drop when a player dies?I tried doing a if statement but it didnt work.I was making it so who ever dies loses 50 dollars and who ever picks up the money gets the 50 dollars.

1 answer

Log in to vote
0
Answered by 7 years ago

Put this inside a local script in startergui. Make a leaderstats value called Dollars inserted in the player.

Make a part called money in Lighting.

Game script:

game.Players.PlayerAdded:connect(function(player)
local leaderstats = Instance.new("ObjectValue", player)
local moneyz = Instance.new("IntValue", leaderstats)
end

StarterPack script:


-- This script lets go of money if script.Parent.Humanoid.Health == 0 then local moneyz = game.Lighting.Money moneyz.CFrame = CFrame.new(v.Character.Torso.Position) * CFrame.new(0, 5, 0) end

And have a script inside the money in lighting.

Lighting Money Script:

script.Parent.Touched:connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if hit.Parent.Humanoid ~= nil then
print("Make Money! :-)")
player.stats.money.Value = player.stats.money.Value + 1
script.Parent:Destroy()
end
end)
0
I made the leaderstat value but this doesnt work Robloxfanpeep2 -5 — 7y
0
The leaderstat value has to be inside player and the money value has to be inside the leaderstat value bigbenbennett 18 — 7y
Ad

Answer this question