how to make i pick up the tool is not disappear
wwwwwhhhhhaaaaattttt do you mean specifically by that
1 Like
what
Do you mean like when there’s a tool in the workspace and when you touch it it gets sent into ur inventory???
And do you mean only having one tool in the inventory or one equipped at a time
do you mean you touch the tool and it goes into your inventory but stays visible and still works to give you the tool again?
1 Like
very well then, this script will do the exact proper following and state what each line functions
local pickupTool = workspace.Sword -- an example, defines to the pickup in workspace
pickupTool.Touched:Connect(function(hit) -- fires upon physical contact with another object
local hum = hit.Parent:FindFirstChild("Humanoid") -- attempt to find a preemptive hum object in a model
if hum ~= nil and hum.Health > 0 then -- checks if it is one and alive
local player = game.Players:GetPlayerFromCharacter(hit.Parent) -- checks if its a player
if player and not player.Backpack:FindFirstChild("Sword") or hit.Parent:FindFirstChild("Sword") then -- checks if its a player as well and checks if they have the tool or not
local clonedTool = pickupTool:Clone() -- clones a rendition of the tool
clonedTool.Parent = player.Backpack -- parents it to the player's backpack
end
end
end)
just make sure the touch interest of the sword is removed so it does not get picked up, anchor it as well and don’t make it so the tool can be dropped as that can allow them to wield it multiple times
1 Like