3D UI: Linui Documentation
  • Linui
  • Library
  • Sample
  • Credits
Powered by GitBook
On this page

Library

local Library = loadstring(game:HttpGet("https://reallinen.github.io/Files/Scripts/Linui.lua"))()

Library.Text

Library.Text = "Example" -- Will change the Library's Text from "Linen" or whatever it says to "Example"

Library.Breathing

Library.Breathing = true -- If true, Library will replicate a breathing animation. [optional] | default: true

Library:Section

local Section = Library:Section("Hello") -- Creates a section
--[[
    If you use the Library to create an element instead of an section,
    It will create the element on the right panel, where the exit button is
    If you create an element in a Section, it will create it on the
    Left panel.
]]

Library:Dropdown or Section:Dropdown

local Dropdown = Section:Dropdown({

	Text = "Dropdown", -- Text of the dropdown
	Data = { "This", "Will", "Be", "In", "The", "Dropdown" }, -- The values that will be in the dropdown. Seperated by a ","

        KeepText = false,  -- If true, when an element is selected, it will keep the "Dropdown" text [optional] | default: false
	Callback = function(value: string) -- Callback of the Dropdown, will fire when a new option has been selected in the dropdown [optional] | default: function() end
		print("Dropdown Selected Option:", value)
	end
}) --[[
    Dropdown:Refresh( value: <table> [ optional ] )
       -- If value/table is not provided then it will fix the Dropdown if it's bugged
    
    Dropdown:Add( value: <string> )
       -- Adds the 'value' into the dropdown
    
    Dropdown:Remove( value: <string> )
       -- if value is not provided then it will remove every element in the dropdown
    
    Dropdown:Get( value: <string> )
       -- Checks if <value> exist in the dropdown and fetches it, returns an Instance
    
    Dropdown:All()
       -- Gets all elements in the dropdown and returns them as a table
]]

Library:Button or Section:Button

local Button = Section:Button({
	
	Text = "Click me", -- Text/Name of the button

	Callback = function() -- What will be fired when the button is clicked [ optional ] | Default: function() end
		print("Button was clicked!")
	end
}) --[[
    Button:Text( value: string ) -- Sets the button text to the value
    Button:Callback() -- Calls the buttons 'Callback'
    Button:Change( value: function ) -- Changes the buttons callback to the value
]]

Library:Label or Section:Label

local Label = Section:Label({
	Text = "I am a Label", -- Text/Name of the label
}) --[[

    Label:Get() -- Gets the text of the label
    Label:Set( value: string ) -- sets the text of the label to value
]]

Library:Slider or Section:Slider

local Slider = Section:Slider({

	Text = "Slider", -- Text/Name of the button
	WaitForMouse = true, -- Wait for the mouse to be done moving the slider [ optional ] | Default: nil/false
	Step = 1, -- How many steps you want the slider to go up/down by [ optional ] | Default: 1

	Min = 1,  -- Minimum Value of the slider [ optional ]  | Default: math.random
	Value = 16, -- Value of the slider [ optional ] | Default: math.random(Min, Max)
	Max = 100, -- Maximum value of the slider [ optional ] | Default: math.random

	Callback = function(value: number --[[ New value of the slider ]], prevalue: number --[[ Previous value of the slider ]]) -- Callback is what will be fired when the slider value changes ( WaitForMouse ) or when the slider value is being changed ( Without WaitForMouse ) [ optional ] | Default: function() end
		if value ~= prevalue then
			print("Slider Value:", value)
		end
	end
}) --[[
    Slider:Get() -- Gets the value of the slider
 
    Slider:Set( value: number, nocall: boolean )
       -- Sets the value of the slider to the provided number
       -- If nocall is true, It will not call the callback
    
    Slider:Text( value: string ) -- Sets the text of the slider to the provided value
]]

Library:Toggle or Section:Toggle

local Toggle = Section:Toggle({

	Text = "Toggle", -- Text of the slider
	Value = false, -- value of the slider [ optional ] | default: false

	Callback = function(value: boolean --[[ current value of the slider ]]) -- Callback of the Toggle [optional]
		print("Toggle #1:", value) -- Prints the value of the toggle when it is changed/toggled
	end
}) --[[

    Toggle:Get() -- Returns the value of the Toggle [ true or false ]
    Toggle:Set( value: boolean ) -- Sets the value of the toggle to the boolean [ boolean must be true or false ]
    Toggle:Toggle() -- Switches the value of the toggle [ If true, toggle will be switched off/to false, If false, toggle will be switched on/to true ]
]]

Library:Color or Section:Color

local ColorPicker = Library:Color({ 
    Text = "Color Picker",
    Color = Color3.fromRGB(255, 255, 255), -- set a custom color [ optional ] | default: White/Color3.fromRGB(255, 255, 255)
    Callback = function(color: Color3) -- color is a RGB color [ Color3.fromHSV ]
	print("Color:", color.R, color.G, color.B) -- will print out in HSV
	local r, g, b = color.R * 255, color.G * 255, color.B * 255
	print(r, g, b) -- will print out in RGB color format instead of HSV
    end
}) --[[

    ColorPicket:Text( value: string ) 
    -- Sets the text of the ColorPicker to value
    
    ColorPicker:Set(color: Color3, nocall: boolean) 
    -- If nocall is true, it will not call the "Callback", by default nocall is false
    
    ColorPicker:Get() 
    -- Gets the current color
]]
PreviousLinuiNextSample

Last updated 1 year ago