0% found this document useful (0 votes)
47 views7 pages

Fluent Explicado

Script

Uploaded by

fandondoyuri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views7 pages

Fluent Explicado

Script

Uploaded by

fandondoyuri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 7

Este código cria uma interface de usuário (UI) no Roblox usando a biblioteca

Fluent. Abaixo, um tutorial para entender cada parte:

1. Carregar a biblioteca Fluent e gerenciar add-ons:

local Fluent =
loadstring(game:HttpGet("https://github.com/dawid-scripts/Fluent/releases/latest/
download/main.lua"))()

Esses três comandos carregam a biblioteca principal e dois gerenciadores (salvar


configurações e gerenciar interface).

2. Criar a Janela Principal:

local Window = Fluent:CreateWindow({


Title = "Fluent " .. Fluent.Version,
TabWidth = 160, Size = UDim2.fromOffset(580, 460), Theme = "Dark"
})

Esta parte cria a janela principal da interface com tema escuro e define o tamanho
e título.

3. Adicionar Abas (Tabs):

local Tabs = {
Main = Window:AddTab({ Title = "Main" }),
Settings = Window:AddTab({ Title = "Settings", Icon = "settings" })
}

Aqui, duas abas são adicionadas: Main (principal) e Settings (configurações).

4. Adicionar Elementos na Aba Main:

Notificação:

Fluent:Notify({ Title = "Notification", Content = "This is a notification" })

Exibe uma notificação simples.

Parágrafo:

Tabs.Main:AddParagraph({ Title = "Paragraph", Content = "This is a paragraph.\


nSecond line!" })

Exibe um parágrafo com texto formatado.

Botão:

Tabs.Main:AddButton({ Title = "Button", Callback = function() ... end })

Adiciona um botão que abre um diálogo com opções de confirmação.

Toggle (Alternador):
local Toggle = Tabs.Main:AddToggle("MyToggle", { Title = "Toggle" })
Toggle:OnChanged(function() print(Options.MyToggle.Value) end)

Adiciona um alternador (on/off) que executa uma função ao ser ativado.

5. Outros Elementos:

Slider: Controle deslizante de valores.

Dropdown: Menu suspenso com múltiplas opções.

Colorpicker: Seletor de cores com transparência.

Keybind: Atalho de teclado personalizável.

Input: Campo de texto para inserção de valores.

6. Adicionar Funcionalidade dos Add-ons:

SaveManager:SetLibrary(Fluent)
InterfaceManager:SetLibrary(Fluent)

O SaveManager e InterfaceManager são integrados à janela Fluent para gerenciar


configurações e interfaces.

7. Finalizar:

Window:SelectTab(1)
Fluent:Notify({ Title = "Fluent", Content = "The script has been loaded." })

Define a aba selecionada e exibe uma notificação de sucesso.

copie:

local Fluent =
loadstring(game:HttpGet("https://github.com/dawid-scripts/Fluent/releases/latest/
download/main.lua"))()

local Window = Fluent:CreateWindow({


Title = "Exemplo Básico",
Size = UDim2.fromOffset(400, 300),
Theme = "Light"
})

local MainTab = Window:AddTab({ Title = "Principal" })

MainTab:AddButton({
Title = "Clique-me",
Callback = function()
print("Botão clicado!")
end
})

local Slider = MainTab:AddSlider("Volume", {


Title = "Ajuste o Volume",
Min = 0, Max = 100, Default = 50
})

Slider:OnChanged(function(Value)
print("Volume ajustado para:", Value)
end)

Fluent:Notify({
Title = "Bem-vindo",
Content = "Interface carregada com sucesso!"
})

#### codigo completo ######

local Fluent =
loadstring(game:HttpGet("https://github.com/dawid-scripts/Fluent/releases/latest/
download/main.lua"))()
local SaveManager =
loadstring(game:HttpGet("https://raw.githubusercontent.com/dawid-scripts/Fluent/
master/Addons/SaveManager.lua"))()
local InterfaceManager =
loadstring(game:HttpGet("https://raw.githubusercontent.com/dawid-scripts/Fluent/
master/Addons/InterfaceManager.lua"))()

local Window = Fluent:CreateWindow({


Title = "Fluent " .. Fluent.Version,
SubTitle = "by dawid",
TabWidth = 160,
Size = UDim2.fromOffset(580, 460),
Acrylic = true, -- The blur may be detectable, setting this to false disables
blur entirely
Theme = "Dark",
MinimizeKey = Enum.KeyCode.LeftControl -- Used when theres no MinimizeKeybind
})

--Fluent provides Lucide Icons https://lucide.dev/icons/ for the tabs, icons are
optional
local Tabs = {
Main = Window:AddTab({ Title = "Main", Icon = "" }),
Settings = Window:AddTab({ Title = "Settings", Icon = "settings" })
}

local Options = Fluent.Options

do
Fluent:Notify({
Title = "Notification",
Content = "This is a notification",
SubContent = "SubContent", -- Optional
Duration = 5 -- Set to nil to make the notification not disappear
})

Tabs.Main:AddParagraph({
Title = "Paragraph",
Content = "This is a paragraph.\nSecond line!"
})

Tabs.Main:AddButton({
Title = "Button",
Description = "Very important button",
Callback = function()
Window:Dialog({
Title = "Title",
Content = "This is a dialog",
Buttons = {
{
Title = "Confirm",
Callback = function()
print("Confirmed the dialog.")
end
},
{
Title = "Cancel",
Callback = function()
print("Cancelled the dialog.")
end
}
}
})
end
})

local Toggle = Tabs.Main:AddToggle("MyToggle", {Title = "Toggle", Default =


false })

Toggle:OnChanged(function()
print("Toggle changed:", Options.MyToggle.Value)
end)

Options.MyToggle:SetValue(false)

local Slider = Tabs.Main:AddSlider("Slider", {


Title = "Slider",
Description = "This is a slider",
Default = 2,
Min = 0,
Max = 5,
Rounding = 1,
Callback = function(Value)
print("Slider was changed:", Value)
end
})

Slider:OnChanged(function(Value)
print("Slider changed:", Value)
end)
Slider:SetValue(3)

local Dropdown = Tabs.Main:AddDropdown("Dropdown", {


Title = "Dropdown",
Values = {"one", "two", "three", "four", "five", "six", "seven", "eight",
"nine", "ten", "eleven", "twelve", "thirteen", "fourteen"},
Multi = false,
Default = 1,
})

Dropdown:SetValue("four")

Dropdown:OnChanged(function(Value)
print("Dropdown changed:", Value)
end)

local MultiDropdown = Tabs.Main:AddDropdown("MultiDropdown", {


Title = "Dropdown",
Description = "You can select multiple values.",
Values = {"one", "two", "three", "four", "five", "six", "seven", "eight",
"nine", "ten", "eleven", "twelve", "thirteen", "fourteen"},
Multi = true,
Default = {"seven", "twelve"},
})

MultiDropdown:SetValue({
three = true,
five = true,
seven = false
})

MultiDropdown:OnChanged(function(Value)
local Values = {}
for Value, State in next, Value do
table.insert(Values, Value)
end
print("Mutlidropdown changed:", table.concat(Values, ", "))
end)

local Colorpicker = Tabs.Main:AddColorpicker("Colorpicker", {


Title = "Colorpicker",
Default = Color3.fromRGB(96, 205, 255)
})

Colorpicker:OnChanged(function()
print("Colorpicker changed:", Colorpicker.Value)
end)

Colorpicker:SetValueRGB(Color3.fromRGB(0, 255, 140))


local TColorpicker = Tabs.Main:AddColorpicker("TransparencyColorpicker", {
Title = "Colorpicker",
Description = "but you can change the transparency.",
Transparency = 0,
Default = Color3.fromRGB(96, 205, 255)
})

TColorpicker:OnChanged(function()
print(
"TColorpicker changed:", TColorpicker.Value,
"Transparency:", TColorpicker.Transparency
)
end)

local Keybind = Tabs.Main:AddKeybind("Keybind", {


Title = "KeyBind",
Mode = "Toggle", -- Always, Toggle, Hold
Default = "LeftControl", -- String as the name of the keybind (MB1, MB2 for
mouse buttons)

-- Occurs when the keybind is clicked, Value is `true`/`false`


Callback = function(Value)
print("Keybind clicked!", Value)
end,

-- Occurs when the keybind itself is changed, `New` is a KeyCode Enum OR a


UserInputType Enum
ChangedCallback = function(New)
print("Keybind changed!", New)
end
})

-- OnClick is only fired when you press the keybind and the mode is Toggle
-- Otherwise, you will have to use Keybind:GetState()
Keybind:OnClick(function()
print("Keybind clicked:", Keybind:GetState())
end)

Keybind:OnChanged(function()
print("Keybind changed:", Keybind.Value)
end)

task.spawn(function()
while true do
wait(1)

-- example for checking if a keybind is being pressed


local state = Keybind:GetState()
if state then
print("Keybind is being held down")
end

if Fluent.Unloaded then break end


end
end)

Keybind:SetValue("MB2", "Toggle") -- Sets keybind to MB2, mode to Hold


local Input = Tabs.Main:AddInput("Input", {
Title = "Input",
Default = "Default",
Placeholder = "Placeholder",
Numeric = false, -- Only allows numbers
Finished = false, -- Only calls callback when you press enter
Callback = function(Value)
print("Input changed:", Value)
end
})

Input:OnChanged(function()
print("Input updated:", Input.Value)
end)
end

-- Addons:
-- SaveManager (Allows you to have a configuration system)
-- InterfaceManager (Allows you to have a interface managment system)

-- Hand the library over to our managers


SaveManager:SetLibrary(Fluent)
InterfaceManager:SetLibrary(Fluent)

-- Ignore keys that are used by ThemeManager.


-- (we dont want configs to save themes, do we?)
SaveManager:IgnoreThemeSettings()

-- You can add indexes of elements the save manager should ignore
SaveManager:SetIgnoreIndexes({})

-- use case for doing it this way:


-- a script hub could have themes in a global folder
-- and game configs in a separate folder per game
InterfaceManager:SetFolder("FluentScriptHub")
SaveManager:SetFolder("FluentScriptHub/specific-game")

InterfaceManager:BuildInterfaceSection(Tabs.Settings)
SaveManager:BuildConfigSection(Tabs.Settings)

Window:SelectTab(1)

Fluent:Notify({
Title = "Fluent",
Content = "The script has been loaded.",
Duration = 8
})

-- You can use the SaveManager:LoadAutoloadConfig() to load a config


-- which has been marked to be one that auto loads!
SaveManager:LoadAutoloadConfig()

You might also like