I don’t get it please ask your question again
How would I make it so it doesn’t just stay there like it’s frozen?
Frozen ? The only thing you can do is increasing the sway intensity by putting a larger number in the variable ‘Intensity’
If you could look at the gif you would get it.
No I don’t get it either. the gif is low quality
I want the gun to move back to the middle slowly but its staying where the sway is
Its because you don’t have a main cframe, main cframe is the idle positio of your viewmodel.
If you have it, add it within the SetPrimaryPartCFrame()
What do you mean by that?
And how do I do that?
Main CFrame is the CFrame where you gun will go everytime, and here, if you had a Main CFrame, it would go to middle as you said.
Getting a MainCFrame iskind of boring since you have to test and test to get the good CFrame, you can start with CFrame.new(-.5, 1, -.8) to see and then adjust
MainCF = CFrame.new(-.5, 1, -.8)
Viewmodel:SetPrimarypartCFrame(camera.CFrame * MainCF * SwayCF)
I mean when I move my camera the sway doesn’t reset
Show me your entire script please
game:GetService(“RunService”).RenderStepped:Connect(function(deltaTime)
local RotationCFrame = workspace.CurrentCamera.CFrame:toObjectSpace(LastCameraCFrame) – Get Rotation relative to workspace.CurrentCamera
local X, Y, Z = RotationCFrame:toOrientation() – Get Each Axis from the CFrame components
local a = 0
SwayCF = SwayCF:Lerp(CFrame.Angles(0, 0, math.sin(Y)),0.5) – Apply our rotation to SwayCFrame
workspace.CurrentCamera.CFrame= workspace.CurrentCamera.CFrame – Reset workspace.CurrentCamera.CFrame
end)
game:GetService(“RunService”).RenderStepped:Connect(function()
if game.Workspace.CurrentCamera:FindFirstChild(“Arms”) then
game.Workspace.CurrentCamera.Arms.HumanoidRootPart.CFrame = game.Workspace.CurrentCamera.CFrame * walkcf * SwayCF
end
end)
This is what sets the viewmodel cframe and the stuff
This may help.
Goes on about ViewModel sway, velocities, and all things you technically need.
Did it using some hacky mousedelta stuff.
local mouseDelta = game:GetService(“UserInputService”):GetMouseDelta() | |
---|---|
mdx = mouseDelta.X | |
mdy = mouseDelta.Y | |
lerpval = lerpval:Lerp(CFrame.fromEulerAnglesXYZ(0,0,-mdx/100), 0.5) |