A-Chassis Plugin does not work

I am trying to make a plugin which lets you change some aspects of tune before initializing the car. The problem is that Drive local script is not reading updated values of A-Chassis Tune module script.

Example:
Let’s detune our turbocharger boost pressure. Initially it is 15 in the A-Chassis Tune, but we will go for 5.
I changed the value in my Gui,
from
image,
to
image,
and applied the changes.
My script changes each modified value of _Tune, enables the Initialize script and destroys the Gui.

script.Parent.Apply.OnServerEvent:Connect(function(player, tune)
	--[[Above it changes the _Tune.Value for each tuned part.]]
	car["A-Chassis Tune"].Initialize.Enabled = true
	script.Parent:Destroy()
end)

All of the changes are applied correctly, because print(_Tune.T_Boost) that I’ve put in the Initialize script outputs number 5:
image.
So it should work right? Wrong. So I checked if the Drive local script gets the value from _Tune with print(_Tune.T_Boost) and it doesn’t:
image
I have no idea why the Drive local script doesn’t take the values from A-Chassis Tune module script.

Hi!
If you want to change the module script, you must do it so that the information goes from the server to the local script (e.g. using remote event) and from the local script to the module script.

if you update info in modular script :
server → server
client → cleint

You need to have an additional script that will update the values ​​on the client.

The Initialize script itself does nothing but enabling the Drive.
The Drive local script does not take the changed values because of the line
local torque = math.lerp(_Tune.T_MinT, _Tune.T_MaxT, throttle)
It should output different value of torque, but it doesn’t.

local function onChanged(prop)
if prop == “Throttle” and throttle > 0 then
local torque = math.lerp(_Tune.T_MinT, _Tune.T_MaxT, throttle)
print(_Tune.T_Boost)
print(torque)
end
end

As I said, the problem is that I can’t get the Drive local script to take the values from the A-Chassis Tune module script. I can’t find anything that would work. The only way to make it work is to initialize the car with the values I want, but I want to do it with a Gui and not with a script.
Please, help.
Thanks in advance and sorry for my English.

The script was created before the change and it’s not updating the value, only changing the copy in the script. You have to replace the script in the Drive local script.

in what script do you put local torque = math.lerp(_Tune.T_MinT, _Tune.T_MaxT, throttle)?

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