-- Gui

local DisplayGui = script:WaitForChild("DisplayGui")
local ColorGui = script:WaitForChild("ColorGui")
local NewDisplayGui = nil
local NewColorGui = nil

function UndoSettings(Folder)
	for _,v in pairs(Folder:GetChildren()) do
		if v:IsA("NumberValue") or v:IsA("IntValue") then
			v.Value = 0
		elseif v:IsA("ObjectValue") and v.Name ~= "SpawnedSegway" then
			v.Value = nil
		end
	end
end

function RemoveSegway()
	
	-- Remove segway
	DestroySegway:FireServer(Character,SpawnedSegway)
	
	-- Reset camera
	Camera.CameraType = "Custom"
	
	-- Show tool
	ConfigTool:FireServer(0,Tool,false,nil)
	
	-- Undo tags anyway
	HasSpawnedSegway.Value = false

	-- UnPlatformStand player
	ConfigHumanoid:FireServer(Humanoid,false,false,true)
	
	-- If player has the segway controller script, we'll reset its settings
	if PlayerGui:FindFirstChild("GuiControls") then -- Remove mobile gui
		PlayerGui:FindFirstChild("GuiControls").Parent = script
	end
	UserInputService.ModalEnabled = false
	UndoSettings(ToolStatus)
end
