This is once again, and extension off of a different recoil post.
Anyways, I have a spring module that I’m trying to use to simulate recoil, and it requires that I use deltaTime for something I don’t understand. Now that’s cool and all, but the only way I know how to use deltaTime, is by doing Runservice.RenderStepped.
Here’s my code:
local Springs = require(game.ReplicatedStorage.springs)
local Camera = workspace.CurrentCamera
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local runServ = game:GetService("RunService")
Springs.Recoil = Springs.create()
function Shove(deltaTime)
Springs.Recoil:shove(Vector3.new(0.03,0,0))
spawn(function()
wait(.15)
Springs.Recoil:shove(Vector3.new(-0.03,0,0))
end)
local recoil = Springs.Recoil:update(deltaTime)
workspace.Part.CFrame = workspace.Part.CFrame * CFrame.Angles(recoil.x,recoil.y,recoil.z)
end
mouse.Button1Down:Connect(function()
runServ.RenderStepped:Connect(function(deltaTime)
Shove(deltaTime)
wait(10)
end)
end)
YouTube Demonstration: https://www.youtube.com/watch?v=e5apifNE1as
As you can see, due to me using RenderStepped, it causes it to run every second or something. I don’t want that because I’m attaching THAT to the camera. It just looks very jittery and stupid.
Any help would be appreciated ![]()