generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Game Design
Home Search
 

Re: How to make a humanoid drop an item on death?

Previous Thread :: Next Thread 
tdogredman is not online. tdogredman
Joined: 21 Oct 2012
Total Posts: 384
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
CitCatCarrie is not online. CitCatCarrie
Joined: 28 Jan 2014
Total Posts: 426
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
CitCatCarrie is not online. CitCatCarrie
Joined: 28 Jan 2014
Total Posts: 426
09 Aug 2016 12:20 AM
Oops. I went AFK and forgot that I had not finished a sentence XD.
Report Abuse
CitCatCarrie is not online. CitCatCarrie
Joined: 28 Jan 2014
Total Posts: 426
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
jordan0810 is not online. jordan0810
Joined: 03 Jun 2012
Total Posts: 846
09 Aug 2016 12:22 AM
^^^ GG, winning at life.
Report Abuse
CitCatCarrie is not online. CitCatCarrie
Joined: 28 Jan 2014
Total Posts: 426
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
jordan0810 is not online. jordan0810
Joined: 03 Jun 2012
Total Posts: 846
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Game Design
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image