Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Aircraft Reverse Thrusters?

Basically, I've been working on a script that makes the brick transparent on activating the keyword "V" V basically acts as reverse thrusters, but I'd like more of a realistic animation. What I would like is to have the brick fade if the speed is 2, and the brick to change width to around 50 upon when the speed is uppered. This is what I'm currently using

rather then a function, i'd just like it to work where it has the "if key=="v" then" thanks

function fadeBrick(obj) for i = 100, 0: obj.Transparency=i obj.Remove() end

if key == "v" then
		fadeBrick(plane.ReverseThrusters.Left.WeldPart)
	
	end

1 answer

The most efficient way I can see to achieve the effect you desire is to check the current speed and compare it to some breakpoints, after which you can modify the effect to be "realistic".

Here's an example of what I mean:

--I'm assuming this is a LocalScript

local speed = 0 --studs/sec
local accel = 0 --studs/sec/sec

--CODE
if key == "v" then
	accel = -10
end
--CODE

local obj = plane.ReverseThrusters.Left.WeldPart

local t = tick()
game:GetService("RunService").RenderStepped:connect(function()
	local dt = tick()
	dt, t = dt - t, dt --This gets the time delta, so that acceleration is accurate on any framerate.

	speed = speed + accel*dt
	--Wherever you're changing the Position of the aircraft, use `speed` as the speed. :P

	if speed < 0 then	
		obj.Transparency = 1
	elseif speed <= 2 then
		obj.Transparency = 1 - speed/2 --ranges from 0 to 1. Fully opaque at speed = 2, invisible at speed = 0
	end
end)

1 comment

0

Didnt work.

This discussion is preserved as it was. New answers, comments, and votes are closed.