script.Parent.Handle.Touched:connect(function(hit) pcall(function() player = game.Players:getPlayerFromCharacter(hit.Parent) script.Parent:Clone().Parent = player.Backpack script.Parent:Remove() end) end)
How do I make it automatically hold the item when grabbed or taken off the ground?
Hi ken,
local part = script.Parent; -- The part that has the tool. part.Touched:Connect(function(obj) local hum = obj.Parent:FindFirstChildOfClass("Humanoid"); -- To check if a player touched the part. if hum then -- Checks if it's a player that touched the part. local tool = script.Parent:WaitForChild("ToolToGive"):Clone(); -- Clones the tool. tool.Parent = obj.Parent; -- Parents it to the Character part:Destroy(); -- Destroys the part so nobody else can get the tool. end end)
Thanks,
Best regards,
~~ KingLoneCat