How do I make dash range independence on FPS?

My problem is my dash system’s range depends on fps.

30 - 60fps:

120+fps:

here is my code

FrontDashConnection = RS.RenderStepped:Connect(function(delta)
			local At = Instance.new("Attachment",RootPart)
			At.WorldPosition = RootPart.AssemblyCenterOfMass
			At.Name = "Attachment0"
			game.Debris:AddItem(At,.001)
			local Linear = Instance.new("LinearVelocity",RootPart)
			Linear.Attachment0 = At
			Linear.MaxAxesForce = Vector3.new(50000,0,50000)
			Linear.ForceLimitMode = Enum.ForceLimitMode.PerAxis
			game.Debris:AddItem(Linear,.001)
			
			if Speed <= 0 then
				Linear.VectorVelocity = Vector3.zero
				Speed = 0
				FrontDashConnection:Disconnect()
				task.delay(.35,function()
					Universal:Fire({"Dash Hit", Character})
				end)
				return
			end
			Linear.VectorVelocity = RootPart.CFrame.LookVector*Speed*delta*60
			Speed-=3.5*delta*60
		end)
1 Like

RenderStepped runs the script every frame, so maybe use PreSimulation.

I don’t think you need to account for delta time in VectorVelocity, as the engine should already take care of that.
You should also probably use BasePart:ApplyImpulse(), as you’re only applying the force for one frame it seems.

2 Likes

He doesn’t, removing *delta*60 on the vectorvelocity will indeed fix the issue because the Speed will reduce quicker on lower frames than higher frames because of deltatime.

what i said is false, nevermind

okie this one works very well tysm :slight_smile:

i’ve tried removing delta time in vectorvelocity and it works very well tysm

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.