Dragonvn

Drop item

Jun 12th, 2019
540
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. function drop() -- Making a drop function
  2. local maths = math.random(1, 6) -- change 6 to however many nothings and tools you have (Right now its a 1 in 6 chance of dropping the tool)
  3. local tool = game.ReplicatedStorage.Tools:FindFirstChild("StarBucks") -- Finding the tool
  4. local nothing = game.ReplicatedStorage.Tools:FindFirstChild("Nothing") -- Finding Nothing
  5.  
  6. if maths == 1 then -- The rest of the lines determin which is chosen
  7. local toolc = tool:Clone()
  8. toolc.Parent = game.Workspace
  9. toolc.Handle.CFrame = script.Parent.Head.CFrame + Vector3.new(5,2,0) -- Making the "Tool" Spawn near the Enemy
  10. script:remove()
  11. else if maths == 2 then
  12. local nothingc = nothing:Clone()
  13. nothingc.Parent = game.Workspace
  14. nothingc.Handle.CFrame = script.Parent.Head.CFrame + Vector3.new(0,-200,0) -- making the "Nothing" Spawn under the map
  15. script:remove()
  16. else if maths == 3 then
  17. local nothingc = nothing:Clone()
  18. nothingc.Parent = game.Workspace
  19. nothingc.Handle.CFrame = script.Parent.Head.CFrame + Vector3.new(0,-200,0)
  20. script:remove()
  21. else if maths == 4 then
  22. local nothingc = nothing:Clone()
  23. nothingc.Parent = game.Workspace
  24. nothingc.Handle.CFrame = script.Parent.Head.CFrame + Vector3.new(0,-200,0)
  25. script:remove()
  26. else if maths == 5 then
  27. local nothingc = nothing:Clone()
  28. nothingc.Parent = game.Workspace
  29. nothingc.Handle.CFrame = script.Parent.Head.CFrame + Vector3.new(0,-200,0)
  30. script:remove()
  31. else if maths == 6 then
  32. local nothingc = nothing:Clone()
  33. nothingc.Parent = game.Workspace
  34. nothingc.Handle.CFrame = script.Parent.Head.CFrame + Vector3.new(0,-200,0)
  35. script:remove()
  36. end
  37. end
  38. end
  39. end
  40. end
  41. end
  42. end
  43.  
  44. while true do -- Loop
  45. wait(.1)
  46. if (script.Parent.Enemy.Health <1) then -- If the Enemy dies (Change Enemy to whatever the enemys Humanoid is named)
  47. drop() -- calling the drop function
  48. end
  49. end
Add Comment
Please, Sign In to add comment