Could you teach us how to implement a aim system ? I´ve tried with offsets but it is not working
Update: Added Step 6: Aiming because of demand.
I have some problems with my aiming system, using the same code as you did.
gunmodel.GunComponents.Sight.CFrame = gunmodel.GunComponents.Sight.CFrame:Lerp(viewmodel.HumanoidRootPart.CFrame,game.ReplicatedStorage.Aim.AimValue.Value)
function module.aim(toaim,viewmodel,gun)
if toaim then
game:GetService('TweenService'):Create(game.ReplicatedStorage.Aim.AimValue, TweenInfo.new(1),{Value = 1}):Play()
else
game:GetService('TweenService'):Create(game.ReplicatedStorage.Aim.AimValue, TweenInfo.new(1),{Value = 0}):Play()
end
end
Any fixes? Watch this video
You just have to rotate the part so the orientation is correct.
HumanoidRootPart’s Orientation is 0,0,0.
I meant the sight orientation.
Reposition the sight so it is a bit behind than usual
Thanks man, helped me alot keep up with these great tutorials.
what value is AimAlpha? a bool, an int?
“AimAlpha” is a Number Value .
Hello,
It appears all the videos are broken for me for both part 1 and 2.
Hey, im not sure why it isnt tweening, ive just started doing the aiming, and I had triple checked this it looks the same as yours, but I’m not sure whats wrong, this is my code.(Also this is just as you start it and get the tween working)
local-
game:GetService("UserInputService").InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
IsPlayerHoldingMouse = true
end
if input.UserInputType == Enum.UserInputType.MouseButton2 then
mainModule.aim(true, Viewmodel, GunModel)
end
end)
game:GetService("UserInputService").InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
IsPlayerHoldingMouse = false
end
if input.UserInputType == Enum.UserInputType.MouseButton2 then
mainModule.aim(false, Viewmodel, GunModel)
end
end)
module-
function module.aim(toaim, viewmodel, gun)
if toaim then
game:GetService("TweenService"):Create(game.ReplicatedStorage.Values.AimAlpha, TweenInfo.new(1), { Value = 1 }):Play()
gun.Components.Sight.CFrame = gun.Components.Sight.CFrame:Lerp(viewmodel.HumanoidRootPart.CFrame, game.ReplicatedStorage.Values.AimAlpha.Value)
else
game:GetService("TweenService"):Create(game.ReplicatedStorage.Values.AimAlpha, TweenInfo.new(1), { Value = 0 }):Play()
gun.Components.Sight.CFrame = gun.Components.Sight.CFrame:Lerp(viewmodel.HumanoidRootPart.CFrame, game.ReplicatedStorage.Values.AimAlpha.Value)
end
end
Alright, that was a mistake on my part. It should be fixed.
like this?
function module.update(viewmodel, dt, RecoilSpring, BobbleSpring, SwayingSpring, gun)
gun.Components.Sight.CFrame = gun.Components.Sight.CFrame:Lerp(viewmodel.HumanoidRootPart.CFrame, game.ReplicatedStorage.Values.AimAlpha.Value)
Yeah that seems about correct.
And how can you make a play button and when you click on it, you will get a weapon?
And gun choice.
Im bad programmer…
UPDATE: Here are the scripts for you to compare with your own: fpsframeworkscripts.rbxm (5.8 KB). (apologies for not providing this earlier)
This acted as a very helpful tool for me. Haven’t found anything else like it. If possible, and you being a programmer and all, kindle advise the way forward when it comes to adding other weapons to the game. It however seems to be limited to only one gun.
Thanks.