I am making a game and want to make a union face the player but only for them and I have no clue how to even make it face the player non locally. Please help.
How would I make a part face the player for only them?
1 answer
There is a server/client boundary that exists, and only the player can see the client boundary. Other players cannot see other players client boundaries.
The answer would be to use a LocalScript , which gives access to this client boundary.
First, we need to use CFrame. It's not complicated, and is very similiar to Vector3, but comes with a rotation matrix. More on the developer API above.
-- In localscript, running in PlayerScripts
local part = game.Workspace.Part -- Get the part from workspace
local target = game.Workspace.Target -- Get the target the part will be pointing at
part.CFrame = CFrame.new(part.Position,target.Position) -- Rotate the part
Now while this does solve your problem, you may want it to constantly point at the target while it moves. This can be solved by using RunService, which allows us to call a function every frame, much faster then any while wait() do.
-- In localscript, running in PlayerScripts
local part = game.Workspace.Part -- Get the part from workspace
local target = game.Workspace.Target -- Get the target the part will be pointing at
local runservice = game:GetService("RunService") -- Get runservice
runservice.RenderStepped:Connect(function() -- Define the function and attach it to RenderStepped
part.CFrame = CFrame.new(part.Position,target.Position) -- Rotate the part
end)
This should solve your problem. If there are errors, please comment.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Thank you a lot for this. I appreciate your help.