Ok so i’m making a game with a sword fighting arena section in it, and I wanted it to be like, a certain area where you can equip the sword and use it, and when you leave, it unequips and your unable to kill people anywhere else, but I did this, and I have need help with fixing this ://. Idk whats wrong with it
script.Parent.Touched:Connect(function(hit)
local hum = hit.Parent:FindFirstChild('Humanoid')
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if hum and not IsTouching then
IsTouching = true
hit.Parent:FindFirstChild('Humanoid'):LoadTool(Plr.Backpack.ClassicSword)
end
end)
script.Parent.TouchEnded:Connect(function(hit)
local hum = hit.Parent:FindFirstChild('Humanoid')
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if hum and IsTouching then
IsTouching = false
hit.Parent:FindFirstChild('Humanoid'):UnequipTools()
end
end)