How do I go about making a local script a server script?

I’m new to this side of Roblox scripting as I only know the basics, like part manipulation, but I don’t know much past that.
I want this script to be serverside for a canvas game:

local Tool = script.Parent
local gui = Tool:WaitForChild('Paintbucket')
local current = Tool.Value
local container = gui.Drag.Main.Scroll
local p = game.Players.LocalPlayer
local pgui = p.PlayerGui
local mouse = p:GetMouse()
local heartbeat = game:GetService('RunService').Heartbeat
local function hwait()
	return heartbeat:Wait()
end

local selectionBox = Instance.new('SelectionBox', p.Character)
local selectionLasso = Instance.new('SelectionPartLasso', p.Character)
selectionLasso.Humanoid = p.Character.Humanoid

for _,button in next, container:GetChildren() do
	button.MouseButton1Click:Connect(function()
		if button.Name ~= current.Value.Name then
			for i = 2,0,-1 do
				container:FindFirstChild(current.Value.Name).BorderSizePixel = i
				hwait()
			end
			current.Value = BrickColor.new(button.Name)
			for i = 0,2 do
				button.BorderSizePixel = i
				hwait()
			end
			container.Parent.Selected.Text = current.Value.Name
		end
	end)
end

function setSelectionBox(part) 
	unsetSelectionBox()
	selectionBox.Adornee = part
	selectionLasso.Part = part
end

function unsetSelectionBox() 
	selectionBox.Adornee = nil
	selectionLasso.Part = nil
end

function canSelectObject(part)
	return part and not (part.Locked) and (part.Position - p.Character.Head.Position).Magnitude < 60
end

function setColor(part)
	if canSelectObject(part) then
		part.BrickColor = current.Value
		Tool.Handle.PaintSound:Play()
		Tool.Handle.PaintSound.PlaybackSpeed = .9 + (math.random() * .1)
	end
end

game:GetService('RunService').RenderStepped:Connect(function()
	if gui.Enabled then
		local part = mouse.Target
		if canSelectObject(part) then
			mouse.Icon ="rbxasset://textures\\FillCursor.png"
			setSelectionBox(part)
		else
			mouse.Icon = ''
			unsetSelectionBox()
		end
	end
end)

mouse.Button1Down:Connect(function()
	setColor(mouse.Target)
	print(tostring(p) .. " painted " .. mouse.Target.Name .. " with the colour " .. tostring(current.Value) .. "!")
end)

gui.Parent = pgui

Tool.Equipped:Connect(function()
	gui.Drag.Position = UDim2.new(0,0,0.5,-230)
	gui.Enabled = true
end)

Tool.Unequipped:Connect(function()
	gui.Enabled = false
end)

I don’t know what to change at all. Where do I start ?

yo whats up! communicating between local scripts and server scripts can be confusing, especially if your new to scripting (or new to server-client communication.) what you can do is use Remote Events to communicate between the client and server, or vice versa. so what you could do is have a serverscript that gets all of the players and does this stuff. for things like the mouse (which is owned by the client) you’d have to use remote events if you want to get stuff like it’s position. i’d recommend reading that link i provided. another solution is to just shove it into ChatGPT and ask it to help you, and explain how it works. just a note that for some reason ChatGPT sometimes just makes up stuff that doesn’t work or exist. if you need any more help or clarification just let me know!