-
I’m Trying to change String Values While Module script uses them
-
The only issue im facing is that the module doesn’t use the updated values and is using the prior value set
-
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
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