I have been trying the old script
local debounce = false function getPlayer(humanoid) local players = game.Players:children() for i = 1, #players do if players[i].Character.Humanoid == humanoid then return players[i] end end return nil end function onTouch(part) local human = part.Parent:findFirstChild("Humanoid") if (human ~= nil) and debounce == false then debounce = true local player = getPlayer(human) if (player == nil) then return end script.Parent:clone().Parent = player.Backpack wait(2) debounce = false end end script.Parent.Parent.Touched:connect(onTouch)
This is the one that doesn't work.
So I tried fixing it but it still didn't work. Can you help me?
local partToTouch = Workspace.Part local toolToGive = Game.ServerStorage.toolName partToTouch.Touched:connect(function(potentialPlayer) if potentialPlayer and potentialPlayer.Parent and Game.Players:GetPlayerFromCharacter(potentialPlayer.Parent) then --Safety first local provenPlayer = Game.Players:GetPlayerFromCharacter(potentialPlayer.Parent) if not provenPlayer.Backpack:FindFirstChild(toolToGive.Name) then toolToGive:Clone().Parent = provenPlayer.Backpack end end end