Trying to make my hover car move while tween is playing

i have a floating effect on my car that im trying to keep playing while the car is moving. also im not really sure on what’s the best way to add velocity to a car so any help is appreciated tysm!!

		local function floating_tweens()
			local floatdown_CF = zalek.PrimaryPart.CFrame * CFrame.new(0, -5, 0)
			local tinfo = TweenInfo.new(2.5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, -1, true, 0)
			zalek_data.floatTween = ts:Create(zalek.PrimaryPart, tinfo, {CFrame = floatdown_CF})
			zalek_data.floatTween:Play()
		end

		local function stopfloating_tweens()
			if zalek_data.floatTween then
				zalek_data.floatTween:Cancel()
			end
		end

		local function detect_carfloating(value)
			if value == true then
				floating_tweens()
			else
				stopfloating_tweens()
				if zalek_data.tween_upwards then
					zalek_data.tween_upwards:Cancel()
				end
			end
		end
		zalek_data.car_isfloating.Changed:Connect(detect_carfloating)

local function givecar_velocity(p, action_name)
	if action_name == "fly_forward" then
		zalek.PrimaryPart.AssemblyLinearVelocity = Vector3.new(50, 0, 0)
	elseif action_name == "stop_fly_forward" then
		zalek.PrimaryPart.AssemblyLinearVelocity = Vector3.new(0, 0, 0)
	elseif action_name == "fly_backwards" then
		
	elseif action_name == "stop_fly_backwards" then
		
	end
end
keys_event.OnServerEvent:Connect(givecar_velocity)

Tweening the PrimaryPart wont work like that because its conflicting with the AssemblyLinearVelocity

something you could do is weld a part onto the hover part and tween the welds.C0 property

this video will show you how to do that

but this still wont really solve your problem because you still need a force that pushes the car up to keep it hovering because relying on the tween to keep your car hovering wont really work that well here is a video showing how to hover using physics

1 Like

hey suphi,
first of all i love your videos. you dive into intricate topics and educate step by step and i’ve learnt a lot from your hoverboard video. thank u so much for putting those up!!

so i may have named the title incorrectly. i have my gravity set up so the car stays in the air, that’s fine its just im trying to make like a slight floating up / floating down animation like that in the video but i don’t want it to conflict with the velocity of the car. would what you said achieve that?

tysm for your help once again :slight_smile:

yes tweening the weld or using a animation like i did in the first video i sent you will both solve your problem

but you cant tween the floating part it self because that will prevent it from moving

1 Like

Try using a Vector3Value and Tween that, not sure if thats the solution ur Looking for but you could use .Changed on it and then Change the Position, actually do that for the hover

1 Like

perfect job. thanks a million for your help suphi!!

hey Noel,
thanks for your help mate. to my recollection i believe i did do that and i think it was still interfering with the car’s CFrame but thanks a million thO!!

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