Car Performance Upgrade Module script value Issue (A-Chassis)

  1. I’m Trying to change String Values While Module script uses them

  2. The only issue im facing is that the module doesn’t use the updated values and is using the prior value set

  3. I’ve tried using Remote Functions to change the values which helps with what I wanted to achieve, But still doesn’t fix it

These are the 3 scripts that i’m using

They’re ripped from my old Car customization system which was just meant for visual effects and not script modifications like these

-- Server script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local EngineUpgrade = ReplicatedStorage:WaitForChild("EngineUpgrade")

local function EngineUpG(player, vehicle, EngineLvL)
	print("Received")
	local engineUpgrade = vehicle.Customization:FindFirstChild("EngineUpgrade")
	if engineUpgrade then
		engineUpgrade.Value = EngineLvL
	end
end
EngineUpgrade.OnServerEvent:Connect(EngineUpG)

--Client script
local event = game.ReplicatedStorage:WaitForChild("EngineUpgrade")

local Upgrade1 = script.Parent.EngineUpgrades.LvL1.Value
local Upgrade5 = script.Parent.EngineUpgrades.LvL5.Value


script.Parent.Lvl1.MouseButton1Click:Connect(function()
	print("Hit Level 1")
	event:FireServer(script.Parent.Parent.Car.Value, Upgrade1)
end)
script.Parent.Lvl5.MouseButton1Click:Connect(function()
	print("Hit Level 5")
	event:FireServer(script.Parent.Parent.Car.Value, Upgrade5)
end)



A-Chassis modded portion

--[[Engine]]
Tune.Horsepower = script.Parent.Customization.EngineUpgrade.Value

block

The Car value is changed to the players car that is driven when they touch the Garage
Lvl1 = 50
Lvl5 = 500
These values just make it easy to see change in the cars power

The main issue


It shows the value changing but the module isn’t updating to use the new value
values are supposed to change like this: 100-50-500
But they are staying the same like this: 100-100-100

If someone could help with this issue i would be pretty grateful
I’m not the best at scripting but I know enough to get me somewhere but not enough to fix it

3 Likes
--[[Engine]]
Tune.Horsepower = script.Parent.Customization.EngineUpgrade.Value

You need to make the module check the value each time it it used.

If you make the .Value part of the variable then it won’t update.

2 Likes

I’ve realised that part, but i’m still not sure how I would go about doing that

1 Like

Try and modify the Drive script.

Screen Shot 2023-11-14 at 6.06.54 PM

1 Like

like so?

1 Like

Did you try it out?

Did it work?

I tried it out and all that happened was an error that showed that the Customization folder wasn’t apart of the player.

The error

19:14:11.955 Customization is not a valid member of Player “Players.X70PA” - Client - Drive:465

Check your path.

Then maybe turn it into a variable:

local customization = script.Parent.Parent.Parent:WaitForChild("Customization")
local engineUpgrade = customization:WaitForChild("EngineUpgrade")

-- Horsepower Curve
local fgc_h = engineUpgrade.Value

The path changes when the player actually sits down
image

So don’t use script.Parent.Parent.Parent.

Before sitting in seat:
Screen Shot 2023-11-14 at 6.39.46 PM

After sitting in seat:
Screen Shot 2023-11-14 at 6.39.25 PM

I have my Customs Folder in the car model and not in the A-Chassis interface
image

Should i move it then?

Right; move it into the A-Chassis Interface and see if it works as expected.

It still doesn’t update the speed, but i think it since
Tune.Horsepower = script.Parent.Customization.EngineUpgrade.Value
and
local fgc_h= script.Parent.Customization.EngineUpgrade.Value/100
arent a valid direction anymore
And i’m not too sure how to access the folder from the player using a module
Sorry if i’m not making any sense