Let's suppose a player equipped a tool 'x'. Now when he dies, I want that tool to be equipped again. So that the player does not have to continuously equip the tool every time he dies.
Here is my attempt:
local Player = game.Players.LocalPlayer local Character = Player.Character or Player.CharacterAdded:Wait() local StarterGear = Player.StarterGear local Backpack = Player.Backpack local toolOnDeath = {} wait(1) Backpack.ChildRemoved:Connect(function(removedChild) if removedChild:IsA("Tool") then table.insert(toolOnDeath, removedChild) end end) Player.CharacterAdded:Connect(function() print("CharacterAdded") if toolOnDeath ~= nil then for i, v in pairs(toolOnDeath) do if v:IsA("Tool") then print("Tool is going to be equipped now") Character.Humanoid:EquipTool(v) end end end end)
But this does not work. "Tool is going to be equipped now" prints but the humanoid does not equip the tool. Why?
Thanks for any help