Trying to make resize script server sided

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    i would like to make a size tool i made server side
  2. What is the issue? Include screenshots / videos if possible!
    i do not know how to do it.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    i tried making a server side script that connects to the local script, which did not work
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
    this is the client script:
wait(.2)

bin = script.Parent

lastDistR = 0
lastDistL = 0
lastDistF = 0
lastDistB = 0
lastDistT = 0
lastDistB2 = 0

local handles = script.Parent.Handles
handles.Name = "ResizeToolHandles"
local sb = script.Parent.SB
sb.Name = "ResizeToolSelectionBox"

local onSide = false
local dragging = false

function MouseDrag(side, distance)
	local part = handles.Adornee
	if part == nil then return end
	if tostring(side) == "Enum.NormalId.Right" then
		if distance - lastDistR > 1 then
			local newDist = math.floor(distance - lastDistR)
			local cf = part.CFrame * CFrame.fromAxisAngle(Vector3.new(0, 1, 0), -math.pi/2)
			local lv = cf.lookVector
			local cf2 = part.CFrame
			local size = part.Size
			part.Size = Vector3.new(part.Size.x + newDist, part.Size.y, part.Size.z)
			if part.Size == size then
				part.CFrame = cf2 + lv * (0.5*newDist)
				cf2 = part.CFrame
			end
			part.CFrame = cf2 + lv * (0.5*newDist)
			lastDistR = lastDistR + newDist
		else
			if distance - lastDistR < -1 and part.Size.x + math.ceil(distance - lastDistR) < 1 then
				local newDist = -(part.Size.x - 1)
				local cf = part.CFrame * CFrame.fromAxisAngle(Vector3.new(0, 1, 0), -math.pi/2)
				local lv = cf.lookVector
				local cf2 = part.CFrame
				local size = part.Size
				part.Size = Vector3.new(part.Size.x + newDist, part.Size.y, part.Size.z)
				if part.Size == size then
					part.CFrame = cf2 + lv * (0.5*newDist)
					cf2 = part.CFrame
				end
				part.CFrame = cf2 + lv * (0.5*newDist)
				lastDistR = lastDistR + newDist
			else
				if distance - lastDistR < -1 and part.Size.x + math.ceil(distance - lastDistR) > 0  then
					local newDist = math.ceil(distance - lastDistR)
					local cf = part.CFrame * CFrame.fromAxisAngle(Vector3.new(0, 1, 0), -math.pi/2)
					local lv = cf.lookVector
					local cf2 = part.CFrame
					local size = part.Size
					part.Size = Vector3.new(part.Size.x + newDist, part.Size.y, part.Size.z)
					if part.Size == size then
						part.CFrame = cf2 + lv * (0.5*newDist)
						cf2 = part.CFrame
					end
					part.CFrame = cf2 + lv * (0.5*newDist)
					lastDistR = lastDistR + newDist
				end
			end
		end
	end

	if tostring(side) == "Enum.NormalId.Left" then
		if distance - lastDistL > 1 then
			local newDist = math.floor(distance - lastDistL)
			local cf = part.CFrame * CFrame.fromAxisAngle(Vector3.new(0, 1, 0), math.pi/2)
			local lv = cf.lookVector
			local cf2 = part.CFrame
			local size = part.Size
			part.Size = Vector3.new(part.Size.x + newDist, part.Size.y, part.Size.z)
			if part.Size == size then
				part.CFrame = cf2 + lv * (0.5*newDist)
				cf2 = part.CFrame
			end
			part.CFrame = cf2 + lv * (0.5*newDist)
			lastDistL = lastDistL + newDist
		else
			if distance - lastDistL < -1 and part.Size.x + math.ceil(distance - lastDistL) < 1 then
				local newDist = -(part.Size.x - 1)
				local cf = part.CFrame * CFrame.fromAxisAngle(Vector3.new(0, 1, 0), math.pi/2)
				local lv = cf.lookVector
				local cf2 = part.CFrame
				local size = part.Size
				part.Size = Vector3.new(part.Size.x + newDist, part.Size.y, part.Size.z)
				if part.Size == size then
					part.CFrame = cf2 + lv * (0.5*newDist)
					cf2 = part.CFrame
				end
				part.CFrame = cf2 + lv * (0.5*newDist)
				lastDistL = lastDistL + newDist
			else
				if distance - lastDistL < -1 and part.Size.x + math.ceil(distance - lastDistL) > 0  then
					local newDist = math.ceil(distance - lastDistL)
					local cf = part.CFrame * CFrame.fromAxisAngle(Vector3.new(0, 1, 0), math.pi/2)
					local lv = cf.lookVector
					local cf2 = part.CFrame
					local size = part.Size
					part.Size = Vector3.new(part.Size.x + newDist, part.Size.y, part.Size.z)
					if part.Size == size then
						part.CFrame = cf2 + lv * (0.5*newDist)
						cf2 = part.CFrame
					end
					part.CFrame = cf2 + lv * (0.5*newDist)
					lastDistL = lastDistL + newDist
				end
			end
		end
	end

	if tostring(side) == "Enum.NormalId.Front" then
		if distance - lastDistF > 1 then
			local newDist = math.floor(distance - lastDistF)
			local cf = part.CFrame
			local lv = cf.lookVector
			local cf2 = part.CFrame
			local size = part.Size
			part.Size = Vector3.new(part.Size.x, part.Size.y, part.Size.z + newDist)
			if part.Size == size then
				part.CFrame = cf2 + lv * (0.5*newDist)
				cf2 = part.CFrame
			end
			part.CFrame = cf2 + lv * (0.5*newDist)
			lastDistF = lastDistF + newDist
		else
			if distance - lastDistF < -1 and part.Size.z + math.ceil(distance - lastDistF) < 1 then
				local newDist = -(part.Size.z - 1)
				local cf = part.CFrame
				local lv = cf.lookVector
				local cf2 = part.CFrame
				local size = part.Size
				part.Size = Vector3.new(part.Size.x, part.Size.y, part.Size.z + newDist)
				if part.Size == size then
					part.CFrame = cf2 + lv * (0.5*newDist)
					cf2 = part.CFrame
				end
				part.CFrame = cf2 + lv * (0.5*newDist)
				lastDistF = lastDistF + newDist
			else
				if distance - lastDistF < -1 and part.Size.z + math.ceil(distance - lastDistF) > 0  then
					local newDist = math.ceil(distance - lastDistF)
					local cf = part.CFrame
					local lv = cf.lookVector
					local cf2 = part.CFrame
					local size = part.Size
					part.Size = Vector3.new(part.Size.x, part.Size.y, part.Size.z + newDist)
					if part.Size == size then
						part.CFrame = cf2 + lv * (0.5*newDist)
						cf2 = part.CFrame
					end
					part.CFrame = cf2 + lv * (0.5*newDist)
					lastDistF = lastDistF + newDist
				end
			end
		end
	end

	if tostring(side) == "Enum.NormalId.Back" then
		if distance - lastDistB > 1 then
			local newDist = math.floor(distance - lastDistB)
			local cf = part.CFrame * CFrame.fromAxisAngle(Vector3.new(0, 1, 0), math.pi)
			local lv = cf.lookVector
			local cf2 = part.CFrame
			local size = part.Size
			part.Size = Vector3.new(part.Size.x, part.Size.y, part.Size.z + newDist)
			if part.Size == size then
				part.CFrame = cf2 + lv * (0.5*newDist)
				cf2 = part.CFrame
			end
			part.CFrame = cf2 + lv * (0.5*newDist)
			lastDistB = lastDistB + newDist
		else
			if distance - lastDistB < -1 and part.Size.z + math.ceil(distance - lastDistB) < 1 then
				local newDist = -(part.Size.z - 1)
				local cf = part.CFrame * CFrame.fromAxisAngle(Vector3.new(0, 1, 0), math.pi)
				local lv = cf.lookVector
				local cf2 = part.CFrame
				local size = part.Size
				part.Size = Vector3.new(part.Size.x, part.Size.y, part.Size.z + newDist)
				if part.Size == size then
					part.CFrame = cf2 + lv * (0.5*newDist)
					cf2 = part.CFrame
				end
				part.CFrame = cf2 + lv * (0.5*newDist)
				lastDistB = lastDistB + newDist
			else
				if distance - lastDistB < -1 and part.Size.z + math.ceil(distance - lastDistB) > 0  then
					local newDist = math.ceil(distance - lastDistB)
					local cf = part.CFrame * CFrame.fromAxisAngle(Vector3.new(0, 1, 0), math.pi)
					local lv = cf.lookVector
					local cf2 = part.CFrame
					local size = part.Size
					part.Size = Vector3.new(part.Size.x, part.Size.y, part.Size.z + newDist)
					if part.Size == size then
						part.CFrame = cf2 + lv * (0.5*newDist)
						cf2 = part.CFrame
					end
					part.CFrame = cf2 + lv * (0.5*newDist)
					lastDistB = lastDistB + newDist
				end
			end
		end
	end

	if tostring(side) == "Enum.NormalId.Top" then
		local r = 1.2
		if tostring(part.formFactor) == "Enum.FormFactor.Plate" then
			r = 0.4
		end
		if tostring(part.formFactor) == "Enum.FormFactor.Symmetric" then
			r = 1
		end
		if distance - lastDistT > r then
			local newDist = distance - lastDistT
			local cf = part.CFrame * CFrame.fromAxisAngle(Vector3.new(1, 0, 0), math.pi/2)
			local lv = cf.lookVector
			local cf2 = part.CFrame
			local size = part.Size
			part.Size = Vector3.new(part.Size.x, part.Size.y + newDist, part.Size.z)
			if true then
				newDist = part.Size.y - size.y
			end
			if part.Size == size then
				part.CFrame = cf2 + lv * (0.5*newDist)
				cf2 = part.CFrame
			end
			part.CFrame = cf2 + lv * (0.5*newDist)
			lastDistT = lastDistT + newDist
		else
			if distance - lastDistT < -r and part.Size.y + (distance - lastDistT) < r then
				local newDist = -(part.Size.y - r)
				local cf = part.CFrame * CFrame.fromAxisAngle(Vector3.new(1, 0, 0), math.pi/2)
				local lv = cf.lookVector
				local cf2 = part.CFrame
				local size = part.Size
				part.Size = Vector3.new(part.Size.x, part.Size.y + newDist, part.Size.z)
				if true then
					newDist = part.Size.y - size.y
				end
				if part.Size == size then
					part.CFrame = cf2 + lv * (0.5*newDist)
					cf2 = part.CFrame
				end
				part.CFrame = cf2 + lv * (0.5*newDist)
				lastDistT = lastDistT + newDist
			else
				if distance - lastDistT < -r and part.Size.y + (distance - lastDistT) > r  then
					local newDist = (distance - lastDistT)
					local cf = part.CFrame * CFrame.fromAxisAngle(Vector3.new(1, 0, 0), math.pi/2)
					local lv = cf.lookVector
					local cf2 = part.CFrame
					local size = part.Size
					part.Size = Vector3.new(part.Size.x, part.Size.y + newDist, part.Size.z)
					if true then
						newDist = part.Size.y - size.y
					end
					if part.Size == size then
						part.CFrame = cf2 + lv * (0.5*newDist)
						cf2 = part.CFrame
					end
					part.CFrame = cf2 + lv * (0.5*newDist)
					lastDistT = lastDistT + newDist
				end
			end
		end
	end

	if tostring(side) == "Enum.NormalId.Bottom" then
		local r = 1.2
		if tostring(part.formFactor) == "Enum.FormFactor.Plate" then
			r = 0.4
		end
		if tostring(part.formFactor) == "Enum.FormFactor.Symmetric" then
			r = 1
		end
		if distance - lastDistB2 > r then
			local newDist = distance - lastDistB2
			local cf = part.CFrame * CFrame.fromAxisAngle(Vector3.new(1, 0, 0), -math.pi/2)
			local lv = cf.lookVector
			local cf2 = part.CFrame
			local size = part.Size
			part.Size = Vector3.new(part.Size.x, part.Size.y + newDist, part.Size.z)
			if true then
				newDist = part.Size.y - size.y
			end
			if part.Size == size then
				part.CFrame = cf2 + lv * (0.5*newDist)
				cf2 = part.CFrame
			end
			part.CFrame = cf2 + lv * (0.5*newDist)
			lastDistB2 = lastDistB2 + newDist
		else
			if distance - lastDistB2 < -r and part.Size.y + (distance - lastDistB2) < r then
				local newDist = -(part.Size.y - r)
				local cf = part.CFrame * CFrame.fromAxisAngle(Vector3.new(1, 0, 0), -math.pi/2)
				local lv = cf.lookVector
				local cf2 = part.CFrame
				local size = part.Size
				part.Size = Vector3.new(part.Size.x, part.Size.y + newDist, part.Size.z)
				if true then
					newDist = part.Size.y - size.y
				end
				if part.Size == size then
					part.CFrame = cf2 + lv * (0.5*newDist)
					cf2 = part.CFrame
				end
				part.CFrame = cf2 + lv * (0.5*newDist)
				lastDistB2 = lastDistB2 + newDist
			else
				if distance - lastDistB2 < -r and part.Size.y + (distance - lastDistB2) > r  then
					local newDist = (distance - lastDistB2)
					local cf = part.CFrame * CFrame.fromAxisAngle(Vector3.new(1, 0, 0), -math.pi/2)
					local lv = cf.lookVector
					local cf2 = part.CFrame
					local size = part.Size
					part.Size = Vector3.new(part.Size.x, part.Size.y + newDist, part.Size.z)
					if true then
						newDist = part.Size.y - size.y
					end
					if part.Size == size then
						part.CFrame = cf2 + lv * (0.5*newDist)
						cf2 = part.CFrame
					end
					part.CFrame = cf2 + lv * (0.5*newDist)
					lastDistB2 = lastDistB2 + newDist
				end
			end
		end
	end
end

function onButton1Down(side)
	onDown()
	if handles.Adornee == nil then return end
	if tostring(side) == "Enum.NormalId.Right" then
		lastDistR = 0
	end
	if tostring(side) == "Enum.NormalId.Left" then
		lastDistL = 0
	end
	if tostring(side) == "Enum.NormalId.Front" then
		lastDistF = 0
	end
	if tostring(side) == "Enum.NormalId.Back" then
		lastDistB = 0
	end
	if tostring(side) == "Enum.NormalId.Top" then
		lastDistT = 0
	end
	if tostring(side) == "Enum.NormalId.Bottom" then
		lastDistB2 = 0
	end
end

function onEnter(mouse)
	onSide = true
	mouse.Icon = "rbxasset://textures\\DragCursor.png"
end

function onLeave(mouse)
	onSide = false
	if dragging == true then return end
	mouse.Icon = "rbxasset://textures\\DragCursor.png"
end

function onDown()
	dragging = true
end

function onUp(mouse)
	if dragging == false then return end
	dragging = false
	if onSide == false then
		mouse.Icon = "rbxasset://textures\\DragCursor.png"
	end
end

function onClick(mouse)
	local obj = mouse.Target
	if obj ~= nil then
		if obj.Locked == true then
			return
		end
	end
	handles.Adornee = obj
	sb.Adornee = obj
end

function onSelected(mouse)
mouse.Icon = "rbxasset://textures\\DragCursor.png"
	if con1 ~= nil then
		con1:disconnect()
		con2:disconnect()
		con3:disconnect()
	end
	onSide = false
	dragging = false
	con1 = handles.MouseEnter:connect(function() onEnter(mouse) end)
	con2 = handles.MouseLeave:connect(function() onLeave(mouse) end)
	con3 = mouse.Button1Up:connect(function() onUp(mouse) end)
	handles.Parent = bin.Parent.Parent:FindFirstChild("PlayerGui")
	sb.Parent = handles.Parent
	mouse.Button1Down:connect(function() onClick(mouse) end)
end

function onDeselected()
	handles.Adornee = nil
	sb.Adornee = nil
end

handles.MouseDrag:connect(MouseDrag)
handles.MouseButton1Down:connect(onButton1Down)

bin.Selected:connect(onSelected)
bin.Deselected:connect(onDeselected)

i would like to know how to make it server sided

also, tell me if this is the wrong category. this is my first forum post xD