example code 3

local panel = ascendify.panel({
	name = "Example 3",
	size = UDim2.new(0, 360, 0, 340),
	position = UDim2.new(0, 360, 0, 300),
	no_dock = true,
})

local column = ascendify.column(panel.items)
local section = ascendify.section(column, { name = "Flags" })

section:button_holder({})

ascendify.button(section, {
	name = "Print Flags",
	callback = function()
		print(ascendify.get_flag("ex3_enabled"), ascendify.get_flag("ex3_mode"), ascendify.get_flag("ex3_speed"), ascendify.get_flag("ex3_input"))
	end
})

ascendify.button(section, {
	name = "Notify",
	callback = function()
		ascendify.create_notification({ text = "hello", time = 1.2 })
	end
})

ascendify.button(section, {
	name = "Hide/Show Speed",
	callback = function()
		ascendify.set_visible("ex3_speed", not ascendify.get_flag("ex3_speed_hidden"))
		ascendify.set_flag("ex3_speed_hidden", not ascendify.get_flag("ex3_speed_hidden"))
	end
})

section:button_holder({})

ascendify.input(section, { name = "Input", flag = "ex3_input" })
ascendify.dropdown(section, { name = "Mode", flag = "ex3_mode", items = { "A", "B", "C" }, default = "A" })
ascendify.slider(section, { name = "Speed", flag = "ex3_speed", min = 0, max = 100, default = 25, interval = 1 })

local enabled = ascendify.toggle(section, { name = "Enabled", flag = "ex3_enabled", default = false })

ascendify.key_picker(enabled, { name = "Key", flag = "ex3_key", mode = "toggle" })
ascendify.color_picker(enabled, { name = "Color", flag = "ex3_color" })

local child_toggle = ascendify.toggle(section, { name = "ChildAdded Notify", flag = "ex3_child_added", default = false })

ascendify.create_connection(workspace.ChildAdded, function(child)
	if ascendify.get_flag("ex3_child_added") and not ascendify.is_purchasing_item() then
		ascendify.create_notification({ text = "Child: " .. tostring(child.Name), time = 1.1 })
	end
end)

ascendify.on_unload(function()
	if panel and panel.items and panel.items.sgui then
		panel.items.sgui:Destroy()
	end
end)

Last updated