That’s what I’m telling you, if you change the value at the beginning of your script (before writing the function) then it won’t connect the function.
Try this script:
local fuel = game.ReplicatedStorage.Fuel
local fuelLoss
game.ReplicatedStorage.Fuel.Changed:Connect(function()
print("Checking stats")
script.Parent.Humanoid.WalkSpeed = fuel.Value/37.5
script.Parent.LowerTorso.Fire.Size = fuel.Value/60
script.Parent.UpperTorso.PointLight.Range = fuel.Value/30
print('Changing Stats')
fuelLoss = 1/(2^(fuel.Value/300))
print('Calculating wait time beofre fuel loss')
wait(fuelLoss)
fuel.Value = fuel.Value - 1
print('Fuel Lost')
end)
wait(5)
fuel.Value = fuel.Value - 1
-- here, the computer already knows what to do when this value is changed
if fuel.Value == 0 then
script.Parent.Humanoid.Health = 0
end