I’m making a car that drives slower when being offroad but the first thing I need working is the changing of the horsepower done by a script. I made this server script:
local tune = require(script.parent["A-Chassis Tune"])
tune.Horsepower = 50
The problem is that the A-Chassis Tune module script is not changing.
I want the car slow down, so could anyone help me with this?
mc7oof
(oof)
March 14, 2024, 4:18pm
#2
Convert the module that has the “settings” in it to use NumberValues instead of variables within the script.
In other words, instead of:
tune.Horsepower = 50
Load the value from a NumberValue:
tune.Horsepower = script.Horsepower.Value
That way to can change the values at any time from other scripts.
1 Like
Still doesn’t change the module script.
Make something like:
Module:
-- A-Chassis Tune module
local Tune = {}
Tune.Horsepower = 100 -- Default horsepower value
return Tune
Script:
-- Server script
local Tune = require(script.Parent["A-Chassis Tune"])
-- Modify horsepower
Tune.Horsepower = 50
That was exactly what I have but doesn’t work.
mc7oof
(oof)
March 15, 2024, 8:28pm
#6
The Module Script named A-Chasiss Tune contains all the values for the vehicle.
It uses variables that are assigned within the script itself. Such as:
Tune.LoadDelay = 3.0
I am suggesting that you rework the script to call the values from Instances stored within the ModuleScript.
Like this:
That way you can access those values at any time and change those values at any time without ever needing to access the ModuleScript.
Try it with Horsepower
and see it it works. If it does then update the entire Module Script.