|
| 08 Aug 2016 11:58 PM |
| I've been stuck trying to make a script for this for a while. I want to make a humanoid drop a "wallet" that gives the player money on death. I have the wallet finished and the script for that done, but i cant make humanoid enemies drop it on death. Any help is appreciated. |
|
|
| Report Abuse |
|
|
|
| 09 Aug 2016 12:19 AM |
I'm a terrible scripter, but I think you have to make a script that clones the wallet and teleports it to the humanoid's location when it's health is down to 0.
Or you could have the wallet follow the humanoid around while the wallet is invisible and becomes visible when the humanoid's health is down to 0. Just make sure the player can't actually collect the money until the humanoid is gone or everyone is going to be farming the humanoids by simply walking into them or however thy
Hope that gives you an idea of what your script needs to contain! :) |
|
|
| Report Abuse |
|
|
|
| 09 Aug 2016 12:20 AM |
| Oops. I went AFK and forgot that I had not finished a sentence XD. |
|
|
| Report Abuse |
|
|
|
| 09 Aug 2016 12:21 AM |
| Just nvm the part after "or" in the second last sentence. I don't remember what I was going to write there o-o |
|
|
| Report Abuse |
|
|
| |
|
|
| 09 Aug 2016 12:25 AM |
| ^ Haha lol XD. It's pretty early in the morning here so I'm not exactly at top performance yet :P. |
|
|
| Report Abuse |
|
|
|
| 09 Aug 2016 12:37 AM |
Haha, but back topic. These two bits of code should do what you want.. i've not tested them but i feel they should work fine.
Putting the below code in the serverScriptService will drop the players inventory on death.
game.Players.PlayerAdded:connect(function(p) p.CharacterAdded:connect(function(c) c.Humanoid.Died:connect(function() for i,v in pairs(p.Backpack:GetChildren()) do if v:IsA("Tool") then v.Parent = workspace v.Handle.Position = c:WaitForChild("Torso").Position end end end) end) end)
Putting the below code in the serverScriptService will drop a predefined item clone on death.
local wallet = game.ServerStorage.Wallet --change as needed
game.Players.PlayerAdded:connect(function(p) p.CharacterAdded:connect(function(c) c.Humanoid.Died:connect(function() clone = wallet:clone() clone.Parent = game.Workspace clone.Position = c:WaitForChild("Torso").Position end) end) end)
|
|
|
| Report Abuse |
|
|