local Character = game.Players.LocalPlayer.Character
local mouse = game.Players.LocalPlayer:GetMouse()
local UserInput = game:GetService("UserInputService")
UserInput.MouseIconEnabled = false
mouse.TargetFilter = workspace
workspace.CurrentCamera.CameraSubject = Character.Body
local last
local Cursor = script.Parent.Main.Cursor
Character.Humanoid.AutoRotate = false
Cursor.Position = UDim2.new(0,mouse.X-(Cursor.Size.X.Offset/2),0,mouse.Y-(Cursor.Size.Y.Offset/2))
local function Update()
if last ~= mouse.Hit then
last = mouse.Hit
local look = mouse.hit.lookVector.Y
if look < -0.7 then
look = -0.7
elseif look > 0.7 then
look = 0.7
end
Character.Hip["HipJoint"].C0 = CFrame.new(Character.Hip["HipJoint"].C0.p) * CFrame.Angles(math.asin(look)+math.rad(180),math.rad(-90),math.rad(180))
Character.Body.CFrame = CFrame.new(Character.HumanoidRootPart.Position, Vector3.new(mouse.Hit.p.X, Character.HumanoidRootPart.CFrame.Y, mouse.Hit.p.Z))
end
end
game:GetService("RunService"):BindToRenderStep("updateCharacter", Enum.RenderPriority.Camera.Value-1, Update)
On the server, you can run a script like this which sets the network ownership of the character’s parts to the player that controls the character once they spawn.
functon onCharacterAdded(characterModel)
-- Set up the player's rig....
-- ....
-- ...
-- Then finally, set the network ownership of each part in the player
-- to the character that controls it.
local player = game.Players:GetPlayerFromCharacter(characterModel)
for _, v in pairs(characterModel:GetDescendants()) do
if v:IsA("BasePart") then
v:SetNetworkOwner(player)
end
end
end
But the player is already controlling it… There is nothing that I’ve put on the server side to control the mech, the mech is pretty much just a normal character. Since this is the case, wouldn’t the client already have network ownership?
And let’s say that what I said above isn’t the case, would that mean that the mech would no longer replicate to the server?