Sword Fighting arena script not working!

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)
2 Likes

I would look into using Region3

I would suggest creating a server script that checks all the swords and if the sword is in the area it changes a variable. This variable will be used to determine if you can equip the sword

1 Like