How would I make this script only work on LocalPlayer but still be inside of its part?

local tool = game.ServerStorage.Sword

game.Players.PlayerAdded:connect(function(plr)
	plr.CharacterAdded:connect(function(chr)
local function onTouch(part)
	if plr.Backpack:FindFirstChild('Sword') ~= nil then
plr.Backpack:FindFirstChild('Sword'):Remove()
	end
	end

script.Parent.Touched:connect(onTouch) 
	end)
	end)

2 comments

0

you could make the script clone a localscript?

0

You need to reconsider your definition of what the 'LocalPlayer' is in this case