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

Need help completing my System Money Dropping on death?

TRYING TO MAKE A CASH DROP ON DEATH!!!!!! Okay so ignore the title but... im trying to make a Drop cash on death, You see... I made the Cash and put it in replicated storage... inside it's brick is

--Under this is the block, Its placed inside Replicated Storage and is being called.
local b = script.Parent --Block Placed inside of Replicated Storage.

b.Touched:Connect(function(hit)
	local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
	plr.leaderstats.Coins.Value = plr.leaderstats.Coins.Value + 239
end)


--Ok so this under is what i put in Starter Character

local deb = false
local mon = game.ReplicatedStorage.GoldBrick:Clone()
local hum = script.Parent:WaitForChild('Humanoid')
local Head = script.Parent:WaitForChild('Head')

if hum.Health < 1 then
	if not deb then
		deb = true
		mon.Parent = script.Parent.Parent
		mon.Position = Head.Position
		wait(1)
		deb = false
	end
end

Like cmon, I've think i did it right... I cloned and teleported the block to the Players head soooooooo... am i supposed to add the effect in the Starter character script instead??

4 comments

0

SOMETHING's WRONG... I USED -----------

0

This is very confusing, can you clarify? What is the issue here? Also, can you put your code inside a code block?

0

What are you trying to do?, what do you need help with?, what is the effect?

0

U can try ro use a Health Changed, i think u cant teleport brick becouse u use If w/o any event (like Changed or Touched) or while true do

1 answer

✓ Accepted answer
local part = game.ReplicatedStorage.Part
local char = script.Parent
local dropped = false

function CashDrop(health)
	if health == 0 and not dropped then
		dropped = true
		local cash = part:Clone()
		cash.Parent = workspace
		cash.Position = char.Head.Position
	end
end

char.Humanoid.HealthChanged:Connect(CashDrop)

u can try to use something like this

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