Client-sided character movement appear on server?

This is not necessarily a problem, but I implemented a feature that makes ur character turn to face your mouse when the tool is equipped, This is on a client-side script inside a tool, I am just wondering how is this getting replicated to other people. I did not expect that It would show up for everyone else but it does? So how does it work?

local function onRenderStepped(deltaTime: number)
	local rootPosition = humanoidRootPart.Position
	local mousePosition = mouse.Hit.Position

	humanoidRootPart.CFrame = CFrame.new(rootPosition, Vector3.new(mousePosition.X, rootPosition.Y, mousePosition.Z))
end

It happens because the network owner of the character is set to the player, which means that movement from the client gets replicated to the server

1 Like

Basically roblox has something called network ownership, When you join a game, roblox gives network ownership of your character to you, the player, what this allows is for the player to control physics stuff and more of the character.

Network ownership can also be applied to other things like parts. By default the network ownership of most things is the game, but again it can be set via the server.

2 Likes

Thanks, I knew the basics of network ownership but never knew that you have network ownership of your character

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.