How to make TweenService go at a constant speed so speed won't change depending on distance

  1. What do you want to achieve? Keep it simple and clear!

I wanna be able to use TweenService on my projectile so that it goes at a constant speed instead of speeding up depending on distance

  1. What is the issue? Include screenshots / videos if possible!

I don’t know how to do this.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I’ve tried looking it up on google chrome and devforum but I can’t quite find anything that will help.

My Code

local character = Player.Character
	local Humrp = character:FindFirstChild("HumanoidRootPart")
	local Humanoid = character:WaitForChild("Humanoid")
	local Fireball = UnClonedFireball:Clone()
	
	local EffectsFold = Instance.new("Folder", workspace)
	EffectsFold.Name = Player.Name.." Effects"
	
	Fireball.Parent = EffectsFold
	Fireball.CFrame = CFrame.new(Humrp.Position) + Vector3.new(0,0,2)
    	
	local TweenInfo = TweenInfo.new(.5,Enum.EasingStyle.Quad,Enum.EasingDirection.Out)
	
	local TweenProperties = 
		{
			
	      CFrame = Fireball.CFrame * CFrame.new(Mouse_Hit.Position)
			
		}
	
	
	local Tween = TweenService:Create(Fireball,TweenInfo,TweenProperties)
	Tween:Play()
	
1 Like

Nvm I figured it out, for anyone wondering how to make it go at a constant speed. You do

local Distance = (StartingPointOfProjectile.Position - MousePositionVariable).Magnitude
print(Distance)--Optional
local Speed = .05--Experiment with speed btw, I think the lower the number the less speed
local TweenTime = Speed * Distance/15

Then plug TweenTime into the time for your Tween

Video I found my answer from: - YouTube

3 Likes

Enum.EasingStyle.Linear

I already tried that but that didn’t work, but thanks for the suggestion though!

I found a solution to my problem

Should work, unless you were overriding tweens, which I presume you were.

If you want the higher number to be faster, and not the lowest number you can do this!!!

local Distance = (StartingPointOfProjectile.Position - MousePositionVariable).Magnitude
print(Distance)--Optional
local Speed = .05--Experiment with speed btw, I think the lower the number the less speed
local TweenTime = 1/Speed * Distance/15