How to: use waist movement in roblox!
Lets just get straight to it. First, make a localscript in startercharacterscripts.
In that script, I recommend putting wait(4) or another method just to make sure the player’s model has loaded in completely by the time the script is executed.
Now, to the scripting part.
First of all, make a RenderStepped loop.
game:GetService("RunService").RenderStepped:Connect(function()
end)
Good. Before the RenderStepped function is called, make a variable called waist that gets the players Waist.
waist = script.Parent:FindFirstChild("Waist",true)
Now in the RenderStepped function, do this:
game:GetService("RunService").RenderStepped:Connect(function()
if waist then
local camDirection = script.Parent:FindFirstChild("HumanoidRootPart").CFrame:ToObjectSpace(workspace.CurrentCamera.CFrame).LookVector
waist.C0 = CFrame.new(0,waist.C0.Y,0) * CFrame.Angles(0,-camDirection.X,0) * CFrame.Angles(camDirection.Y,0,0)
end
end)
There ya go! A finished waist movement system in Roblox!
If you want to have head movement added onto that, add a coroutine to the script and have it run this (I am not explaining how to do it as it is off-topic):
local neckTurn = coroutine.create(function()
game:GetService("RunService").RenderStepped:Connect(function()
wait()
if neck then
local camDirection = hrp.CFrame:ToObjectSpace(workspace.CurrentCamera.CFrame).LookVector
neck.C0 = CFrame.new(0,neck.C0.Y,0) * CFrame.Angles(0,-camDirection.X,0) * CFrame.Angles(camDirection.Y,0,0)
end
end)
end)
and make a variable called neck:
neck = script.Parent:FindFirstChild("Neck",true)
If you notice any mistakes or the script not working, please let me know!
Thank you