Designing an FPS Framework: Beginner’s guide [PART 2]

instead of activating the bobble with x y z velocity, you will only extract the y axis so the bobble will only be active when x and z is changed

edit: ok so i read this back and it made no sense
i meant instead of the velocity having the x, y, and z axis, only make it so the velocity gets the x and z.

local velocity = some vector
local xzVelocity = vector3.new(velocity.x, 0, velocity.z)

Here ya go

instead of .shove, you’re supposed to do :shove

POV: theres no uncopylock game :sob:

i want people to actually learn from my post and not skid so ye no open game

2 Likes

Facts, tho considering people have errors,problems,etc theres a-lot blocking a person from wanting to follow this.

Its a lose,win problem

i have answered most of the problems that people had and i put some requirements before people start following this tutorial. honestly if someone thinks that this tutorial is too hard then they need to master the requirement first before proceeding. i also provided some open source code in the replies, pretty sure its slightly outdated

Well i found something that work
game.Players.LocalPlayer:GetMouse().TargetFilter = Viewmodel -- your viewmodel here

this would probably need a whole other guide, but i can’t seem to figure out where to start on adding multiple guns to the system, i’d appreciate some help of any kind with this

Already asked by someone else,

So, to do that you can do , i know there more andvanced way to do it but huh

script.Parent.Equipped:Connect(function()
    game["Run Service"]:BindToRenderStep("view_Model_render", Enum.RenderPriority.Camera.Value +1, function(dt)
        --view model update function here such as Viewmodel.Primary.CFrame = workspace.CurrentCamera.CFrame
    end)
    
    
    script.Parent.Unequipped:Connect(function()
        game["Run Service"]:UnbindFromRenderStep("view_Model_render");
        workspace.CurrentCamera.Viewmodel:Destroy()
    end)
    
end)
1 Like

If anyone is having problems with aim not tweening and the aimalpha just snapping from 0 to 1, I had the same problem and switched to a numbervalue instead of int and it worked

hello! could you please tell me what colors are your script editor color codes (text, background,…etc) please?, they look very good :}

1 Like

Sorry for the inconvenience, however, the swaying is not working for me. It does not throw any errors or warnings. It simply changes the walking animation:

I’m unsure what I could be doing wrong, as I have been comparing my script to yours for quite a while now.

My update func:

function module.update(viewmodel, dt, recoilSpring, bobbleSpring, swayingSpring, currentModel)
	viewmodel.CameraBone.CFrame = game.Workspace.CurrentCamera.CFrame
	
	local aimPart = currentModel:FindFirstChild("AimPart")
	
	local bobble = Vector3.new(getBobbing(10), getBobbing(5), getBobbing(5))
	local mouseDelta = UIS:GetMouseDelta()
	
	local character = players.LocalPlayer.Character or players.LocalPlayer.CharacterAdded:Wait()
	
	bobbleSpring:shove(bobble / 10 * (character.HumanoidRootPart.Velocity.Magnitude) / 10)
	swayingSpring:shove(Vector3.new(-mouseDelta.X / 500, mouseDelta.Y / 200, 0))
	
	local updatedRecoilSpring = recoilSpring:update(dt)
	local updatedBobbleSpring = bobbleSpring:update(dt)
	local updatedSwaySpring = bobbleSpring:update(dt)
	
	aimPart.CFrame = aimPart.CFrame:Lerp(viewmodel.CameraBone.CFrame, game.ReplicatedStorage.SWATSys.Values.AimAlpha.Value)
	
	viewmodel.CameraBone.CFrame = viewmodel.CameraBone.CFrame:ToWorldSpace(CFrame.new(updatedBobbleSpring.Y, updatedBobbleSpring.X, 0))
	viewmodel.CameraBone.CFrame *= CFrame.new(updatedSwaySpring.X, updatedSwaySpring.Y, 0)
	
	viewmodel.CameraBone.CFrame *= CFrame.Angles(math.rad(updatedRecoilSpring.X) * 2, 0, 0)
	game.Workspace.CurrentCamera.CFrame *= CFrame.Angles(math.rad(updatedRecoilSpring.X), math.rad(updatedRecoilSpring.Y), math.rad(updatedRecoilSpring.Z))
end

Thanks in advance,
Fizzitix

1 Like

Its not actually studio, I’m using VSCode

1 Like

In the video you’re not swinging your camera around to show the sway, so I don’t really know how I would help you.

Nothing happens when I swing my camera around. I was walking to show how the sway changes the walking animation, and doesn’t do what its supposed to do.

Edit so I don’t have to reply: God, that was dumb, can’t believe I didn’t see that lmao. Thanks a lot!

image

1 Like

I am having trouble here. Where do i put this line of script? nevermind, figured it out myself