-
Notifications
You must be signed in to change notification settings - Fork 0
/
Sword Swinging Simulator.luau
119 lines (96 loc) · 4.43 KB
/
Sword Swinging Simulator.luau
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
-- New example script written by wally
-- You can suggest changes with a pull request or something
local repo = 'https://raw.githubusercontent.com/wally-rblx/LinoriaLib/main/'
local Library = loadstring(game:HttpGet(repo .. 'Library.lua'))()
local ThemeManager = loadstring(game:HttpGet(repo .. 'addons/ThemeManager.lua'))()
local SaveManager = loadstring(game:HttpGet(repo .. 'addons/SaveManager.lua'))()
local player = game.Players.LocalPlayer
function touch(part)
firetouchinterest(part, game.Players.LocalPlayer.Character.Head, 0)
firetouchinterest(part, game.Players.LocalPlayer.Character.Head, 1)
end
local Window = Library:CreateWindow({
-- Set Center to true if you want the menu to appear in the center
-- Set AutoShow to true if you want the menu to appear when it is created
-- Position and Size are also valid options here
-- but you do not need to define them unless you are changing them :)
Title = 'Example menu',
Center = true,
AutoShow = true,
})
-- You do not have to set your tabs & groups up this way, just a prefrence.
local Tabs = {
-- Creates a new tab titled Main
Main = Window:AddTab('Main'),
['UI Settings'] = Window:AddTab('UI Settings'),
}
-- Groupbox and Tabbox inherit the same functions
-- except Tabboxes you have to call the functions on a tab (Tabbox:AddTab(name))
local farmingbox = Tabs.Main:AddLeftGroupbox('Farming')
farmingbox:AddToggle('autostrength', {
Text = 'Auto strength',
Default = false, -- Default value (true / false)
Tooltip = 'Get strength for you', -- Information shown when you hover over the toggle
})
Toggles.autostrength:OnChanged(function()
local current_sword = player.currentSwordEquipped.Value
if Toggles.autostrength.Value == true then
local ohString1 = "Equip"
local ohString2 = current_sword
game:GetService("ReplicatedStorage").Events.RemoteEvents.SwordEvent:FireServer(ohString1, ohString2)
elseif Toggles.autostrength.Value == false then
local ohString1 = "Unequip"
local ohString2 = current_sword
game:GetService("ReplicatedStorage").Events.RemoteEvents.SwordEvent:FireServer(ohString1, ohString2)
end
spawn(function()
while Toggles.autostrength.Value == true do
local ohString1 = current_sword
game:GetService("ReplicatedStorage").Events.RemoteEvents.GiveSword:FireServer(ohString1)
task.wait()
end
end)
end)
farmingbox:AddToggle('autosell', {
Text = 'Auto sell',
Default = false, -- Default value (true / false)
Tooltip = 'auto sells', -- Information shown when you hover over the toggle
})
Toggles.autosell:OnChanged(function()
spawn(function()
while Toggles.autosell.Value == true do
touch(game:GetService("Workspace").Map.ImportantAssets.Sells.FirstSell.HitPart)
task.wait(.1)
end
end)
end)
-- UI Settings
local MenuGroup = Tabs['UI Settings']:AddLeftGroupbox('Menu')
-- I set NoUI so it does not show up in the keybinds menu
MenuGroup:AddButton('Unload', function() Library:Unload() end)
MenuGroup:AddLabel('Menu bind'):AddKeyPicker('MenuKeybind', { Default = 'End', NoUI = true, Text = 'Menu keybind' })
Library.ToggleKeybind = Options.MenuKeybind -- Allows you to have a custom keybind for the menu
-- Addons:
-- SaveManager (Allows you to have a configuration system)
-- ThemeManager (Allows you to have a menu theme system)
-- Hand the library over to our managers
ThemeManager:SetLibrary(Library)
SaveManager:SetLibrary(Library)
-- Ignore keys that are used by ThemeManager.
-- (we dont want configs to save themes, do we?)
SaveManager:IgnoreThemeSettings()
-- Adds our MenuKeybind to the ignore list
-- (do you want each config to have a different menu key? probably not.)
SaveManager:SetIgnoreIndexes({ 'MenuKeybind' })
-- 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
ThemeManager:SetFolder('MyScriptHub')
SaveManager:SetFolder('MyScriptHub/specific-game')
-- Builds our config menu on the right side of our tab
SaveManager:BuildConfigSection(Tabs['UI Settings'])
-- Builds our theme menu (with plenty of built in themes) on the left side
-- NOTE: you can also call ThemeManager:ApplyToGroupbox to add it to a specific groupbox
ThemeManager:ApplyToTab(Tabs['UI Settings'])
-- You can use the SaveManager:LoadAutoloadConfig() to load a config
-- which has been marked to be one that auto loads!