-- variables (Made By Er_1x / ERIC#2073)
local hum = script.Parent -- humanoid
local tfolder = game:GetService("ReplicatedStorage"):FindFirstChild("Items") -- finds the folder
local folderc = tfolder:GetChildren() -- gets the items on the folder
local IsModel = false -- check for model if its not a model leave it to false else set it to true
local IsRandom = true -- if set to false add a tool name to get the specific iten you want
local IsTool = true -- checks if its a tool or not IF IT IS A TOOL set it to true if not then flase
local ItemName = "" -- if israndom is set to true leave it blank
-- script part
hum.Died:Connect(function() -- function
if IsRandom == true then
if IsTool == false then
local random = math.random(1, #folderc) -- randomizes
local index = folderc[random] -- index the tool
local item = index:Clone() -- clone the randomized tool
item.Parent = game:GetService("Workspace") -- parent of the tool
if IsModel == true then -- if it is a model or not dont change, only change the one on the variables
item:MoveTo(hum.Parent.Head.Position) -- how we can move it because its a model
else
item.CFrame = hum.Parent.Head.CFrame -- cframe ( position of the tool)
end
print("Random Item Dropped: "..index.Name) -- notify
else
local random = math.random(1, #folderc) -- randomizes
local index = folderc[random] -- index the item
local tool = index:Clone() -- clone the randomized item
tool.Parent = game:GetService("Workspace") -- parent of the item
tool.Handle.CFrame = hum.Parent.Head.CFrame -- cframe ( position of the item)
print("Random Tool Dropped: "..index.Name) -- notify
end
else -- if random is not in true
if IsTool == false then
local item = tfolder:FindFirstChild(ItemName):Clone() -- gets the tool ( finds the tool inside the folder
item.Parent = game:GetService("Workspace") -- parent of the tool
if IsModel == true then -- if it is a model or not dont change, only change the one on the variables
item:MoveTo(hum.Parent.Head.Position) -- how we can move it because its a model
else
item.CFrame = hum.Parent.Head.CFrame -- cframe ( position of the tool)
end
print("Item Dropped: "..ItemName) -- notify
else
local tool = tfolder:FindFirstChild(ItemName):Clone() -- gets the tool ( finds the tool inside the folder
tool.Parent = game:GetService("Workspace") -- parent of the tool
tool.Handle.CFrame = hum.Parent.Head.CFrame -- cframe ( position of the tool)
print("Tool Dropped: "..ItemName) -- notify
end
end
end) -- end of function
i want do if player get the item before he didnt get it again