Hi all. My script is local and is located in StarterPlayerScripts. When you turn your head, only the player can see it. But I want other players to see the head turn too. Help me please
local cam = workspace.CurrentCamera
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local hrp = char:WaitForChild("HumanoidRootPart")
local neck = char:FindFirstChild("Neck", true)
local y = neck.C0.Y
game:GetService("RunService").RenderStepped:Connect(function()
if neck then
local camDirection = hrp.CFrame:ToObjectSpace(cam.CFrame).LookVector
neck.C0 = CFrame.new(0, y, 0) * CFrame.Angles(0, -camDirection.X, 0) * CFrame.Angles(camDirection.Y, 0, 0)
end
end)
Well you’re going to need to use something called a RemoteEvent and send over the angles and then send them back too all the clients but the one that sent the remote, you’ll probably want to do this not so often and have the players lerp the neck positions of the other players so it looks smooth
Remote Events are the event your going to use (as mentioned above^^) but I suggest using Unreliable remote events, and then using Lerp for them. The difference is unreliable events should be used for something like this as you fire this event many times. Unreliable events also fire quicker than remote events, however as the title suggests, their unreliable. This isn’t a problem in this case because you’re firing this event so many times already, and if one fails, it’s not a big deal.