local tool = script.Parent local handle = tool.Handle local playerMouse = game.Players.LocalPlayer:GetMouse() local currenttarget tool.Equipped:connect (function() a = Instance.new("Part", game.Workspace) b = Instance.new("Part", game.Workspace) c = Instance.new("Part", game.Workspace) d = Instance.new("Part", game.Workspace) e = Instance.new("Part", game.Workspace) f = Instance.new("Part", game.Workspace) cor = Instance.new("Part", game.Workspace) a.Position = Vector3.new(1733.5, 9.5, 34.5) b.Position = Vector3.new(1724.499, 9.5, 43.5) c.Position = Vector3.new(1733.5, 9.5, 52.5) d.Position = Vector3.new(1733.5, 18.5, 43.5) e.Position = Vector3.new(1742.5, 9.5, 43.5) f.Position = Vector3.new(1733.5, 0.5, 43.5) cor.Position = Vector3.new(1733.999, 1.5, 43) a.Anchored = true b.Anchored = true c.Anchored = true d.Anchored = true e.Anchored = true f.Anchored = true cor.Anchored = true a.Size = Vector3.new(17, 1, 17) b.Size = Vector3.new(17, 1, 17) c.Size = Vector3.new(17, 1, 17) d.Size = Vector3.new(17, 1, 17) e.Size = Vector3.new(17, 1, 17) f.Size = Vector3.new(17, 1, 17) cor.Size = Vector3.new(2, 1, 2) a.Name = "a" b.Name = "b" c.Name = "c" d.Name = "d" e.Name = "e" f.Name = "f" cor.Name = "cor" a.Orientation = Vector3.new(-90, 0, 0) b.Orientation = Vector3.new(0, 0, 90) c.Orientation = Vector3.new(90, 0, 0) d.Orientation = Vector3.new(0, 0, 0) e.Orientation = Vector3.new(0, 0, -90) f.Orientation = Vector3.new(0, 0, 0) playerMouse.Button1Down:connect(function() if playerMouse.Target then if playerMouse.Target.Parent.ClassName == "Model" then currenttarget = playerMouse.Target.Parent Target:Destroy() print "hi" end end end) end)
-- The error is 15:54:59.001 - Players.Player1.Backpack.Pokeball.LocalScript:59: attempt to index global 'Target' (a nil value)
How do I make it detect a player so I can destory it because I cant use target as the player - Thanks
p.s The Instance.new stuff if to make a pokeball to trap players im only trying to kill players with a click to see if it works
line 4 : currenttarget is undefined and you might want to edit line 57 : currenttarget = playerMouse.Target.Parent and Instance.new("Part", game.Workspace) is also depecrated
cor = Instance.new("Part") cor.Parent = game.Workspace