How do I make this script work on server side?

I understand that i have to use a “remote event” but I have absolutely no clue on how any of the server things work, I finished the whole local script but I want to know how I could make this into a serverside script too?

Local script:

local Player = game:GetService("Players").LocalPlayer
local Mouse = Player:GetMouse()
local tool = script.Parent


tool.Activated:Connect(function()
	print(Mouse.Target.Parent)
	wait(0.1)
	local MouseTargetParent =  Mouse.Target.Parent
	
	local HumanoidFinder = MouseTargetParent:FindFirstChild("Humanoid")
	if HumanoidFinder then
		local leg = HumanoidFinder.Parent:FindFirstChild("LeftLowerLeg")
		local Tie = Instance.new("RopeConstraint")
		local Rock = Instance.new("Part", workspace)
		
		local AttachmentBase = Instance.new("Attachment")
		local AttachmentSide = Instance.new("Attachment")
		
		Tie.Parent = MouseTargetParent:FindFirstChild("LeftLowerLeg")
		AttachmentBase.Parent =  MouseTargetParent:FindFirstChild("LeftUpperLeg")
		AttachmentSide.Parent =  Rock
		
		Tie.Attachment0 = AttachmentBase
		Tie.Attachment1 = AttachmentSide
		Tie.Length = 3
		Tie.Visible = true
		Rock.CFrame = leg.CFrame
		
	else do
			print("e")
			return
				
				
		end
	end

end)
 

Take some time to learn how to make remote events. You shouldn’t post on the devforum if you already know other sources that can help with your problem.

2 Likes