Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Im trying to make the value of fuel change in this module script How can i do it?

Asked by 6 years ago

MAIN SCRIPT

--[ Fuel ]---
local FuelScript = require(game.ServerScriptService.Main:WaitForChild('FuelGiver'))
FuelScript:Fuel()

MODUE SCRIPT (INSIDE MAIN SCRIPT)

local Module = {}

function Module:Fuel()

end

local Points = game.Workspace.Game.PetrolPoints:GetChildren()
local ready = false

Points.Touched:connect(function(hit)
if hit.Name == "DriveSeat" then
    car = hit
ready = true
if hit.Fuel.Value < 10 and ready then
    repeat wait(0.2) car.Fuel.Value = car.Fuel.Value + 0.2 until ----CHANGE TO 10 LITRES
    ready == false or hit.Fuel.Value > 9.9
end
end
end)

Points.TouchEnded:connect(function(y)
    if y == car then
        ready = false
    end
end)
return Module

Answer this question