But for whatever reason it goes under the ground whenever I’m not moving.
I really want to make some realistic swaying so my game can look a bit more realistic.
local swayEffect=.7 -- the more the slower
local camera=workspace.CurrentCamera
local swayCFrame=CFrame.new()
local lastCamCFrame=CFrame.new()
local offset=CFrame.new(0,-.5,0) -- not necessary
workspace.CurrentCamera:GetPropertyChangedSignal("CFrame"):Connect(function()
local rotation=camera.CFrame:ToObjectSpace(lastCamCFrame)
local X,Y,Z=rotation:ToOrientation()
swayCFrame=swayCFrame:Lerp(CFrame.Angles(math.sin(X)*swayEffect,math.sin(Y)*swayEffect,0),.1) --
lastCamCFrame=camera.CFrame
viewModel:SetPrimaryPartCFrame(camera.CFrame *swayCFrame*offset)
end)
This script should not affect it in any way, but why aren’t they anchored? Do you want to make weapon animations through scripts adjusting positions? But it’s easier through animations.
You can only make anchored ‘HumanoidRootPart’ and the rest just rig right. And make sure you turn off ‘CanCollide’ property absolutely in all parts of the model