I’ve tried something it can turn it on but cannot turn it off, any help?
if (Controller) then
Controller:Destroy()
Controller = nil
end
script.Gravity.Changed:Connect(function()
if script.Gravity == false then
if Controller then
Controller:Destroy()
end
else
if (Controller) then
else
Controller = GravityController.new(PLAYERS.LocalPlayer)
Controller.GetGravityUp = GetGravityUp
end
end
end)
It looks like you have a conditional statement in your code that checks whether the “Controller” variable is true or not, and either sets it to “nil” or creates a new GravityController. If you need help turning off this code, you can simply comment it out by adding two dashes (“–”) at the beginning of each line. That way, the code won’t be executed when the program runs.
Alternatively, if you want to turn off this code temporarily while keeping it in your program, you can change the conditional statement to always create a new GravityController by removing the “if (Controller) then” line and the corresponding “else” block.
if (Controller) then
Controller:Destroy()
Controller = nil
end
script.Gravity.Changed:Connect(function()
if script.Gravity.Value == false then
if Controller then
Controller:Destroy()
Controller = nil
end
else
if (Controller) then
else
Controller = GravityController.new(PLAYERS.LocalPlayer)
Controller.GetGravityUp = GetGravityUp
end
end
end)