Hello!
i had been searching in the Roblox documentation and Devforum for anything helpful, but i didnt find anything. this is a script which moves the local players head to the cframe of the camera…how would i do this with the right arm???
wait()
local tweenService = game:GetService("TweenService")
local Camera = workspace.CurrentCamera
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Root = Character:WaitForChild("HumanoidRootPart")
local Neck = Character:FindFirstChild("Neck", true)
local YOffset = Neck.C0.Y
local Hum = Character:WaitForChild("Humanoid")
local IsR6 = (Hum.RigType.Value==0)
local Trso = (IsR6 and Character:WaitForChild("Torso")) or Character:WaitForChild("UpperTorso")
local Body = Player.Character or Player.CharacterAdded:wait()
local Head = Body:WaitForChild("Head")
local NeckOrgnC0 = Neck.C0
local CFNew, CFAng = CFrame.new, CFrame.Angles
local asin = math.asin
local Waist = (not IsR6 and Trso:WaitForChild("Waist"))
local Ang = CFrame.Angles --[Storing these as variables so I dont have to type them out.]
local aSin = math.asin
local aTan = math.atan
local WaistOrgnC0 = (not IsR6 and Waist.C0)
local UpdateSpeed = 0.5
local HeadHorFactor = 1
local HeadVertFactor = 1
local BodyHorFactor = 0.9
local BodyVertFactor = 0.4
local Waist = (not IsR6 and Trso:WaitForChild("Waist"))
game:GetService("RunService").RenderStepped:Connect(function()
local TrsoLV = Trso.CFrame.lookVector
local HdPos = Head.CFrame.p
local CamCF = game.Workspace.CurrentCamera.CoordinateFrame
if Neck then
local Dist = (Head.CFrame.p-CamCF.p).magnitude
local Diff = Head.CFrame.Y-CamCF.Y
if Character.Humanoid.RigType == Enum.HumanoidRigType.R15 then
Neck.C0 = Neck.C0:lerp(NeckOrgnC0*Ang((aSin(Diff/Dist)*HeadVertFactor), -(((HdPos-CamCF.p).Unit):Cross(TrsoLV)).Y*HeadHorFactor, 0), UpdateSpeed/2)
if script["Waist Movement R15 Only"].Value == true and not IsR6 then
Waist.C0 = Waist.C0:lerp(WaistOrgnC0*Ang((aSin(Diff/Dist)*BodyVertFactor), -(((HdPos-CamCF.p).Unit):Cross(TrsoLV)).Y*BodyHorFactor, 0), UpdateSpeed/2)
end
elseif Character.Humanoid.RigType == Enum.HumanoidRigType.R6 then
Neck.C0 = Neck.C0:lerp(NeckOrgnC0*Ang(-(aSin(Diff/Dist)*HeadVertFactor), 0, -(((HdPos-CamCF.p).Unit):Cross(TrsoLV)).Y*HeadHorFactor),UpdateSpeed/2)
end
end
end)
game.ReplicatedStorage.Look.OnClientEvent:Connect(function(otherPlayer, neckCFrame)
local Neck = otherPlayer.Character:FindFirstChild("Neck", true)
if Neck then
tweenService:Create(Neck, TweenInfo.new(0.1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {C0 = neckCFrame}):Play()
end
end)
if not game:GetService("RunService").IsStudio then
end
while wait(script["UpDate Speed"].Value) do
game.ReplicatedStorage.Look:FireServer(Neck.C0)
end