The issue is, I don’t want the distance from the brick to player change. How can I make the brick stay at a set distance from the player?
local RE = workspace.REs.RemoteEvent_PCD
local plrs = game:GetService("Players")
local plr = plrs.LocalPlayer
local character = plr.Character or plr.CharacterAdded:Wait()
while wait(.1) do
local camera = workspace.CurrentCamera
local camera_pos = camera.CFrame.Position
local head_pos = character.Head.Position
local difference = camera_pos - head_pos
local camera_invertedpos = head_pos - difference
RE:FireServer(camera_invertedpos) --sends to the server to change bricks position
end
A unit vector is a normalized copy of the vector. It’s direction is the same but the magnitude of it is only one. You can add that to your code by doing the following:
local difference = (camera_pos - head_pos).unit * 5