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 » Scripters
Home Search
 

Re: how do i make an enemy have a chance to drop an item

Previous Thread :: Next Thread 
bossfights5lyfe is not online. bossfights5lyfe
Joined: 20 May 2015
Total Posts: 2507
21 Aug 2016 05:47 PM
im making an rpg



Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
21 Aug 2016 05:47 PM
math.random()
Report Abuse
bossfights5lyfe is not online. bossfights5lyfe
Joined: 20 May 2015
Total Posts: 2507
21 Aug 2016 05:48 PM
how do i make it give an item


Report Abuse
Flashiness is not online. Flashiness
Joined: 25 Dec 2012
Total Posts: 1212
21 Aug 2016 05:55 PM
math.randomseed(tick())

local random = math.random(1,--insert chance, so for instance 1/3 would be 33% chance)

local humanoid = script.Parent:FindFirstChild("Humanoid") - Assuming the script is inside the enemy and the enemy has a humanoid

local item = game:GetService("ReplicatedStorage"):FindFirstChild("--item name")

humanoid.Changed:connect(function()
if humanoid.Health == 0 and random == 1 then
item:Clone
item.Parent = game.Workspace
item.Position = script.Parent.Position
end
end)

really inefficient method of doing it but it would go something like that


+1
Report Abuse
bossfights5lyfe is not online. bossfights5lyfe
Joined: 20 May 2015
Total Posts: 2507
21 Aug 2016 06:25 PM
it didnt work
i put down a gear's name but nothing happened when i killed it


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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