Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can i make this local script server sided?

Asked by 3 years ago
Edited 3 years ago

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

Log in to vote
0
Answered by 3 years ago

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.

Ad

Answer this question