Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- variables vvv
- local Character = script.Parent
- local Humanoid = Character:FindFirstChildOfClass("Humanoid")
- local RootPart = Character:FindFirstChild("HumanoidRootPart") or Character:FindFirstChild("Torso") -- if root is non existant it would get the cframe of the torso
- local ServiceRS = game:GetService("ReplicatedStorage")
- local ItemFolder = ServiceRS:WaitForChild("Items") -- folder name
- -- configuration vv | note: dont enable isapart and isatool at the same time
- local ItemNames = {"Tool","MeshPart","Part"} -- item names, can use multiple (you could add duplicate names)
- local IsaPart = true -- if the item is a part/meshpart/union
- local IsaTool = false -- if the item is a tool
- local IsRandom = true -- set to true if you want it random
- local ItemName = "MeshPart" -- singular item
- -- randomizer vvv
- function random(Position:CFrame,Parent)
- local mat = #ItemNames
- local item = ItemFolder:WaitForChild(ItemNames[math.random(1,mat)]):Clone() -- get the item from the folder & clone it
- if IsaTool then
- item.Handle.CFrame = Position -- cframe of the item(area of drop)
- item.Parent = Parent -- parent of the item
- elseif IsaPart then
- item.CFrame = Position
- item.Parent = Parent
- end
- end
- -- when player dies vvv
- Humanoid.Died:Connect(function()
- if IsRandom then -- check if random is true or not
- random(RootPart.CFrame,workspace)
- else
- local item = ItemFolder:WaitForChild(ItemName):Clone() -- get the item from the folder & clone it
- if IsaTool then
- item.Handle.CFrame = RootPart.CFrame -- cframe of the item(area of drop)
- item.Parent = workspace -- parent of the item
- elseif IsaPart then
- item.CFrame = RootPart.CFrame
- item.Parent = workspace
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement