so i have a script that drops a players tools once they die it works fine once but after that the tools just disapear
player.Character.Humanoid.Died:Connect(function()
local humanoid = player.Character:WaitForChild("Humanoid")
local HumanoidRootPart = player.Character:WaitForChild("HumanoidRootPart")
local DeathPosition = HumanoidRootPart.CFrame
humanoid:UnequipTools()
for i,v in pairs(player.Backpack:GetChildren()) do
if v:IsA("Tool") and v:FindFirstChild("Handle") and v.CanBeDropped == true then
v.Handle.CFrame = DeathPosition
v.Parent = game.Workspace
end
end
end)
https://gyazo.com/70cb70cbd6ed36a6bef455f6ad64858d
Try cloning the tool and dropping it onto the ground.
You are doing that in a localscript, try to change it to a server script and connect it with a remote event.
EXAMPLE:
LocalScript
player.Character.Humanoid.Died:Connect(function()
local humanoid = player.Character:WaitForChild("Humanoid")
local HumanoidRootPart = player.Character:WaitForChild("HumanoidRootPart")
local DeathPosition = HumanoidRootPart.CFrame
humanoid:UnequipTools()
game.ReplicatedStorage.Event:FireServer(player.Backpack:GetChildren(),humanoid,HumanoidRootPart,DeathPosition)
Server script
game.ReplicatedStorage.Event.OnServerEvent:Connect(function(items,hum,humRP,DeathPos)
for i,v in pairs(items) do
if v:IsA("Tool") and v:FindFirstChild("Handle") and v.CanBeDropped == true then
v.Handle.CFrame = DeathPos
v.Parent = game.Workspace
end
end
end)
end)
o this anit a local script lol
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ToolsFolder = game:GetService("ServerStorage").Tools
local DataStore2 = require(game:GetService("ServerStorage").Modules.DataStore2)
local CombatTaggedList = game:GetService("ServerStorage").PlayerList["Combat Tagged"]
DataStore2.Combine("Data","CombatLog")
Players.PlayerAdded:Connect(function(player)
local CombatLogStore = DataStore2("CombatLog",player)
local ToolStore = DataStore2("Tools",player)
local SavedTools = ToolStore:Get()
if CombatLogStore:Get(false) == true then
print("logged after combat")
CombatLogStore:Set(false)
ToolStore:Set({})
else
if SavedTools ~= nil then
for i,v in pairs(SavedTools) do
if ToolsFolder:FindFirstChild(v) then
local Tool = ToolsFolder[v]
Tool:Clone().Parent = player.Backpack
end
end
end
end
player.Backpack.ChildAdded:Connect(function(child)
local Tools = {}
local Character = player.Character or player.CharacterAdded:Wait()
local HeldTool = Character:FindFirstChildWhichIsA("Tool")
if HeldTool then
table.insert(Tools,HeldTool.Name)
end
for i,v in pairs(player.Backpack:GetChildren()) do
if v:IsA("Tool") then
table.insert(Tools,v.Name)
end
end
ToolStore:Set(Tools)
end)
player.Backpack.ChildRemoved:Connect(function(child)
if not player:FindFirstChild("Backpack") then
return
end
local Tools = {}
local Character = player.Character or player.CharacterAdded:Wait()
local HeldTool = Character:FindFirstChildWhichIsA("Tool")
for i,v in pairs(player.Backpack:GetChildren()) do
if v:IsA("Tool") then
table.insert(Tools,v.Name)
end
end
if HeldTool then
table.insert(Tools,HeldTool.Name)
end
ToolStore:Set(Tools)
end)
player.Character.Humanoid.Died:Connect(function()
local humanoid = player.Character:WaitForChild("Humanoid")
local HumanoidRootPart = player.Character:WaitForChild("HumanoidRootPart")
local DeathPosition = HumanoidRootPart.CFrame
humanoid:UnequipTools()
for i,v in pairs(player.Backpack:GetChildren()) do
if v:IsA("Tool") and v:FindFirstChild("Handle") and v.CanBeDropped == true then
v.Handle.CFrame = DeathPosition
v.Parent = game.Workspace
end
end
end)
end)
Players.PlayerRemoving:Connect(function(player)
if CombatTaggedList:FindFirstChild(player.Name) then
CombatTaggedList[player.Name]:Destroy()
local CombatLogStore = DataStore2("CombatLog",player)
CombatLogStore:Set(true)
CombatLogStore:Save()
end
end)
tried that but still dosnt work
player.Character.Humanoid.Died:Connect(function()
local humanoid = player.Character:WaitForChild("Humanoid")
local HumanoidRootPart = player.Character:WaitForChild("HumanoidRootPart")
local DeathPosition = HumanoidRootPart.CFrame
humanoid:UnequipTools()
for i,v in pairs(player.Backpack:GetChildren()) do
if v:IsA("Tool") and v:FindFirstChild("Handle") and v.CanBeDropped == true then
local ClonedTool = v:Clone()
ClonedTool.Handle.CFrame = DeathPosition
ClonedTool.Parent = game.Workspace
end
end
end)
guys i made a interesting discovery so when i die and pick it up again and then proceed to drop it, it disapears hmmhmmehemhm wat is happening?
https://gyazo.com/a4e4a0ebaedf546d66904689fd32031b