Advertisement
Er1x_Official

Player Item Drop On Death Roblox

Sep 8th, 2021
537
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.88 KB | None | 0 0
  1. -- variables vvv
  2. local Character = script.Parent
  3. local Humanoid = Character:FindFirstChildOfClass("Humanoid")
  4. local RootPart = Character["HumanoidRootPart"]
  5. local ServiceRS = game:GetService("ReplicatedStorage")
  6. local ItemFolder = ServiceRS:WaitForChild("Items") -- folder name
  7. -- configuration vv | note: dont enable isapart and isatool at the same time
  8. local IsaPart = true -- if the item is a part/meshpart/union
  9. local IsaTool = false -- if the item is a tool
  10. local ItemName = "MeshPart"
  11.  
  12. -- when player dies vvv
  13. Humanoid.Died:Connect(function()
  14.     local item = ItemFolder:WaitForChild(ItemName):Clone() -- get the item from the folder & clone it
  15.     if IsaTool then
  16.         item.Handle.CFrame = RootPart.CFrame -- cframe of the item(area of drop)
  17.         item.Parent = workspace -- parent of the item
  18.     elseif IsaPart then
  19.         item.CFrame = RootPart.CFrame
  20.         item.Parent = workspace
  21.     end
  22. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement