--// Event Connections

placeEvent.OnServerEvent:connect(function(plr,newPos,what)

 local char =	plr.Character

	if ACS_Storage.Server:FindFirstChild(plr.Name.."_Rappel") == nil then
			local new = Instance.new('Part')
			new.Parent = workspace
			new.Anchored = true
			new.CanCollide = false
			new.Size = Vector3.new(0.2,0.2,0.2)
			new.BrickColor = BrickColor.new('Black')
			new.Material = Enum.Material.Metal
			new.Position = newPos + Vector3.new(0,new.Size.Y/2,0)
			new.Name = plr.Name.."_Rappel"
			
			local newW = Instance.new('WeldConstraint')
			newW.Parent = new
			newW.Part0 = new
			newW.Part1 = what
			new.Anchored = false
			
			local newAtt0 = Instance.new('Attachment')
			newAtt0.Parent = char.Torso
			newAtt0.Position = Vector3.new(0,-.75,0)

			local newAtt1 = Instance.new('Attachment')
			newAtt1.Parent = new
			
			local newRope = Instance.new('RopeConstraint')
			newRope.Attachment0 = newAtt0
			newRope.Attachment1 = newAtt1
			newRope.Parent = char.Torso
			newRope.Length = 20
			newRope.Restitution = 0.3
			newRope.Visible = true
			newRope.Thickness = 0.1
			newRope.Color = BrickColor.new("Black")

		placeEvent:FireClient(plr,new)
	end
end)

ropeEvent.OnServerEvent:connect(function(plr,dir)
	if workspace:FindFirstChild(plr.Name.."_Rappel") ~= nil then
		if dir == 'Up' then
			plr.Character.Torso.RopeConstraint.Length = plr.Character.Torso.RopeConstraint.Length + 0.2
		elseif dir == 'Down' then
			plr.Character.Torso.RopeConstraint.Length = plr.Character.Torso.RopeConstraint.Length - 0.2
		end	
	end
end)

cutEvent.OnServerEvent:connect(function(plr)
	if workspace:FindFirstChild(plr.Name.."_Rappel") ~= nil then
		workspace:FindFirstChild(plr.Name.."_Rappel"):Destroy()

		plr.Character.Torso.Attachment:Destroy()
		plr.Character.Torso.RopeConstraint:Destroy()
	end
end)
