Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how do i make when people die they drop all there tools?

Asked by 10 years ago

how do i make when people die they drop all there tools?

also when drop tools i want to be able to pick it up when i click on them or just step on them

thanks for reading not much but small

1 answer

Log in to vote
-1
Answered by 10 years ago

Please provide explanation with your answers. Simply posting code does not spread knowledge of integral scripting processes which helps people understand the logic and reasoning behind your answer.

Put this in a server script service

Make a script.

Code:

game.Players.PlayerAdded:connect(function(Player) -- use the PlayerAdded event to get the Player
 Player.CharacterAdded:connect(function(Character) -- use the CharacterAdded event to get the character
 local hum = Character:FindFirstChild("Humanoid") -- get the Humanoid
 local torso = Character:FindFirstChild("Torso") -- get the torso
hum.Died:connect(function() -- when the Humanoid.Health = 0
 for I, tool in pairs(Player.Backpack:GetChildren()) do
  tool.Handle.Position = CFrame.new(torso.Position.X + math.random(0, 5), torso.Position.Y + math.random(0,5), torso.Position.Z + math.random(0,5)) -- places them near Players position
 tool.Parent = Workspace -- adds the tool to the workspace
 end
end)
 end)
end)
0
fixed it btw... DragonSkyye 517 — 10y
Ad

Answer this question