Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can i make this local script server sided?

Its a mouse follow script. However i want to make it serversided so all players can see it.

here is the code:

local localPlayer = game:GetService("Players").LocalPlayer;

local runService = game:GetService("RunService");

local function get_Motor()

	local character = localPlayer.Character;

	local upperTorso = character:WaitForChild("UpperTorso");

	local waist = upperTorso:WaitForChild("Waist");

	return waist
end

local function render_Step()

	local waist = get_Motor();

	local space = localPlayer.Character:WaitForChild("HumanoidRootPart").CFrame:ToObjectSpace(game.Players.LocalPlayer:GetMouse().Origin).lookVector

	waist.C0 = CFrame.new(waist.C0.Position) * CFrame.Angles(0, -math.tan(space.X), 0) * CFrame.Angles(math.tan(space.Y), 0, 0)
end

runService.RenderStepped:Connect(render_Step)

1 answer

Use remotes. If you don’t know what a remote is it basically allows for local scripts to use server scripts. If you don’t know how to use them there’s a couple tutorials on YouTube.

This discussion is preserved as it was. New answers, comments, and votes are closed.