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

How do I make cash drop when someone dies?

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

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)

2 comments

0

I made the leaderstat value but this doesnt work

0

The leaderstat value has to be inside player and the money value has to be inside the leaderstat value

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