0% found this document useful (0 votes)
275 views5 pages

????? ???????

The document outlines a Lua script for creating a user interface in a game using the Rayfield library. It includes features such as tabs, buttons, toggles, sliders, and input fields, allowing for user interaction and configuration saving. The script also demonstrates how to adjust player walk speed and manage UI components dynamically.

Uploaded by

mrtoenails159
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)
275 views5 pages

????? ???????

The document outlines a Lua script for creating a user interface in a game using the Rayfield library. It includes features such as tabs, buttons, toggles, sliders, and input fields, allowing for user interaction and configuration saving. The script also demonstrates how to adjust player walk speed and manage UI components dynamically.

Uploaded by

mrtoenails159
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

local Rayfield = loadstring(game:HttpGet('https://raw.githubusercontent.

com/UI-
Interface/CustomFIeld/main/RayField.lua'))()
local Window = Rayfield:CreateWindow({
Name = "Arrayfield Example Window",
LoadingTitle = "Arrayfield Interface Suite",
LoadingSubtitle = "by Arrays",
ConfigurationSaving = {
Enabled = true,
FolderName = nil, -- Create a custom folder for your hub/game
FileName = "Arrayfield"
},
Discord = {
Enabled = true,
Invite = "GrMJZvp7", -- The Discord invite code, do not include discord.gg/
RememberJoins = true -- Set this to false to make them join the discord every
time they load it up
},
KeySystem = false, -- Set this to true to use our key system
KeySettings = {
Title = "Arrayfield",
Subtitle = "Key System",
Note = "Join the discord (discord.gg/sirius)",
FileName = "SiriusKey",
SaveKey = false,
GrabKeyFromSite = false, -- If this is true, set Key below to the RAW site
you would like Rayfield to get the key from
Key = "Hello"
}
})
local Tab = Window:CreateTab("Tab Example", 4483362458) -- Title, Image
local Tab2 = Window:CreateTab("Tab Example 2") -- Title, Image
local Section = Tab:CreateSection("Section Example",false) -- The 2nd argument is
to tell if its only a Title and doesnt contain element
local Button = Tab:CreateButton({
Name = "Button Example",
Info = "Button info/Description.", -- Speaks for itself, Remove if none.
Interact = 'Changable',
Callback = function()
print('Pressed')
end,
})
local Toggle = Tab:CreateToggle({
Name = "Toggle Example",
Info = "Toggle info/Description.", -- Speaks for itself, Remove if none.
CurrentValue = false,
Flag = "Toggle1", -- A flag is the identifier for the configuration file, make
sure every element has a different flag if you're using configuration saving to
ensure no overlaps
Callback = function(Value)
print(Value)
end,
})
local ColorPicker = Tab:CreateColorPicker({
Name = "Color Picker",
Info = 'info or description',
Color = Color3.fromRGB(2,255,255),
Flag = "ColorPicker1",
Callback = function(Value)
print(Value)
end
})
local player = game.Players.LocalPlayer
local userGui = player:WaitForChild("PlayerGui")
local userInputService = game:GetService("UserInputService")
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local walkSpeedSliderValue = 16

local gui = Instance.new("ScreenGui")


gui.Name = "WalkSpeedGUI"
gui.Parent = userGui

local frame = Instance.new("Frame")


frame.Size = UDim2.new(0, 200, 0, 50)
frame.Position = UDim2.new(0, 10, 0, 10)
frame.BackgroundColor3 = Color3.new(0.5, 0.5, 0.5)
frame.Parent = gui

local slider = Instance.new("TextButton")


slider.Size = UDim2.new(0, 180, 0, 20)
slider.Position = UDim2.new(0, 10, 0, 15)
slider.BackgroundColor3 = Color3.new(0, 0, 0)
slider.Text = "Prędkość: " .. walkSpeedSliderValue
slider.TextColor3 = Color3.new(1, 1, 1)
slider.Parent = frame

local function updateWalkSpeed(value)


walkSpeedSliderValue = value
slider.Text = "Prędkość: " .. walkSpeedSliderValue
humanoid.WalkSpeed = 16 * walkSpeedSliderValue
end

local isDragging = false

slider.MouseButton1Down:Connect(function()
isDragging = true
end)

userInputService.InputEnded:Connect(function(input, gameProcessed)
if isDragging and input.UserInputType == Enum.UserInputType.MouseButton1 then
isDragging = false
end
end)

userInputService.InputChanged:Connect(function(input)
if isDragging and input.UserInputType == Enum.UserInputType.MouseMovement then
local sliderPosition = slider.Position
local sliderSize = slider.Size
local mouseX = input.Position.X

local sliderMinX = sliderPosition.X.Offset


local sliderMaxX = sliderMinX + sliderSize.X.Offset

if mouseX >= sliderMinX and mouseX <= sliderMaxX then


local relativeX = (mouseX - sliderMinX) / sliderSize.X.Offset
local newValue = math.floor(relativeX * 10) + 1
updateWalkSpeed(newValue)
end
end
end)

updateWalkSpeed(walkSpeedSliderValue)
})
local Section2 = Tab:CreateSection("Inputs Examples",true)
Tab:CreateInput({
Name = "Numbers Only",
Info = "Input info/Description.",
PlaceholderText = "Amount",
NumbersOnly = true,
OnEnter = true,
RemoveTextAfterFocusLost = true,
Callback = function(Text)
print(Text)
end,
})
Tab:CreateInput({
Name = "11 Characters Limit",
Info = "Input info/Description.",
PlaceholderText = "Text",
CharacterLimit = 15,
RemoveTextAfterFocusLost = true,
Callback = function(Text)
print(Text)
end,
})
Tab:CreateInput({
Name = "No RemoveTextAfterFocusLost",
Info = "Input info/Description.",
PlaceholderText = "Input",
RemoveTextAfterFocusLost = false,
Callback = function(Text)
print(Text)
end,
})
local Section3= Tab:CreateSection("Dropdown Examples",true)
local MultiSelectionDropdown = Tab:CreateDropdown({
Name = "Multi Selection",
Options = {"Option 1","Option 2",'Option 3'},
CurrentOption = {"Option 1","Option 3"} ,
MultiSelection = true,
Flag = "Dropdown1",
Callback = function(Option)
print(Option)
end,
})
local SingleSelection = Tab:CreateDropdown({
Name = "Single Selection",
Options = {"Option 1","Option 2"},
CurrentOption = "Option 1",
MultiSelection = false,
Flag = "Dropdown2",
Callback = function(Option)
print(Option)
end,
})
local Label = Tab:CreateLabel("Thanks for using Arrayfield, there were alot of
issues but here we are!",Section)
local Paragraph = Tab:CreateParagraph({Title = "Paragraph Example", Content =
"Paragraph Example"},Section)
local Sets = Tab:CreateSection('Set Functions',false)
local SButton
SButton = Tab:CreateButton({
Name = "Button Example",
Interact = 'Interact',
SectionParent = Sets,
Callback = function()
SButton:Set(nil,'New Interaction')
end
})
Tab:CreateButton({
Name = "Dropdown Set",
Interact = 'Interact',
SectionParent = Sets,
Callback = function()
SingleSelection:Set('Option 1')
end
})

local LockTesting = Tab:CreateSection('Lockdown Section',false)


local ToLock = {}
Tab:CreateToggle({
Name = "Lockdown",
SectionParent = LockTesting,
Info = "Toggle info/Description.", -- Speaks for itself, Remove if none.
CurrentValue = false,
Callback = function(Value)
if Value then
for _,v in ToLock do
v:Lock('Locked')
end
else
for _,v in ToLock do
v:Unlock('Locked')
end
end
end,
})
ToLock.Button = Tab:CreateButton({
SectionParent = LockTesting,
Name = "Open speed UI",
Info = "Button info/Description.", -- Speaks for itself, Remove if none.
Interact = 'loadstring(game:HttpGet("https://raw.githubusercontent.com/xHeptc/
Kavo-UI-Library/main/source.lua"))()',
Callback = function()
print('Pressed')
end,
})
ToLock.Toggle = Tab:CreateToggle({
SectionParent = LockTesting,
Name = "Toggle Example",
Info = "Toggle info/Description.", -- Speaks for itself, Remove if none.
CurrentValue = false,
Flag = "Toggle1", -- A flag is the identifier for the configuration file, make
sure every element has a different flag if you're using configuration saving to
ensure no overlaps
Callback = function(Value)
print(Value)
end,
})
ToLock.ColorPicker = Tab:CreateColorPicker({
Name = "Color Picker",
Info = 'info or description',
SectionParent = LockTesting,
Color = Color3.fromRGB(2,255,255),F
Flag = "ColorPicker1",
Callback = function(Value)
print(Value)
end
})
ToLock.Slider = Tab:CreateSlider({
SectionParent = LockTesting,
Name = "Slider Example",
Info = "Button info/Description.",
Range = {0, 100},
Increment = 10,
Suffix = "Bananas",
CurrentValue = 10,
Flag = "Slider1",
Callback = function(Value)
print(Value)
end,
})

You might also like