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.
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)