I'd like some help on a script i'm working on. Its a script that gives a sword when you enter an area then removes it when you leave. It gives the sword and removes the sword. But the problem I'm having is when you enter the area and then un equip the sword it gives you another, and when you leave it only removes 1 and you have to equip the second one for that one to remove aswell. This is not limited to 2 sword though. If u keep unequipping the swords u can get many duplicates. For removing the swords its still 1 by 1. Heres my code:
while wait() do
for i, v in pairs(game.Players:GetChildren()) do
local currentswords = v.Character:FindFirstChild("Sword")
if v and v.Character ~= nil and v.Character:FindFirstChild("Head") and _G.Check(v.Character.Head.Position, workspace.SFArea.Pad) == true and not v.Character:FindFirstChild("Sword", true) then
Sw = game.Lighting.Sword:clone()
Sw.Parent = v.Character
elseif v and v.Character ~= nil and v.Character:FindFirstChild("Head") and _G.Check(v.Character.Head.Position, workspace.SFArea.Pad) == false and v.Character:FindFirstChild("Sword", true) then
v.Character:FindFirstChild("Sword", true):remove()
else
end
end
end
Thanks for your time.
