This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function GetPlayerFromTool(tool) | |
return game:GetService("Players"):GetPlayerFromCharacter(tool.Parent) or tool:FindFirstAncestorWhichIsA("Player") | |
end | |
local function GetCharacterFromTool(tool) | |
local player = GetPlayerFromTool(tool) | |
return player and player.Character | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function Lerp(min, max, alpha) | |
return (max - min) * alpha + min | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function TestTableComparison(eq) | |
local function ComparableTable(instance) | |
return setmetatable(instance, { __eq = eq }) | |
end | |
local a = ComparableTable({ 1, 2, 3, "banana", "apple", 4, 5 }) | |
local b = ComparableTable({ 1, 2, 3, "banana", "apple", 4, 5 }) | |
local c = ComparableTable({ 1, 2, 3, "banana", "apple", 4, 5 }) | |
local d = ComparableTable({ 1, 2, 3, "banana", "orange", 4, 5 }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local DataStoreService = game:GetService("DataStoreService") | |
local leaderstatsDataStore = DataStoreService:GetDataStore("Leaderstats") | |
local Self = {} | |
function Self.add(player) | |
local success, leaderstatsData = pcall(function() | |
return leaderstatsDataStore:GetAsync(player.UserId) | |
end) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local RunService = game:GetService("RunService") | |
local TextService = game:GetService("TextService") | |
local tooltip = script.Parent | |
local player = game.Players.LocalPlayer | |
local mouse = player:GetMouse() | |
local tooltipSizeOffset = tooltip.AbsoluteSize - tooltip.Text.AbsoluteSize | |
local function GetWhitelistedMouseTarget() | |
local target = mouse.Target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local CLONE_STARTER_PLAYER_SCRIPTS = false | |
local CHILDREN_BLACKLIST_NAMES = {"StarterCharacterScripts", "StarterPlayerScripts", "StarterCharacter"} | |
local children = {} | |
for _, child in game.StarterPlayer:GetChildren() do | |
if table.find(CHILDREN_BLACKLIST_NAMES, child.Name) then continue end | |
table.insert(children, child) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local Debris = game:GetService("Debris") | |
local function UntagHumanoid(humanoid) | |
local creatorValue = humanoid:FindFirstChild("creator") | |
if creatorValue and creatorValue:IsA("ObjectValue") then | |
creatorValue:Destroy() | |
end | |
end | |
local function TagHumanoid(humanoid, creator, duration) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local Self = {} | |
Self.Prefix = "/" | |
Self.Separator = " " | |
Self.Delegate = {} | |
function Self.ArgumentsText(...) | |
return table.concat({...}, " ") | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
game:GetService("ContextActionService"):BindAction("findPart", function(_, s, o) | |
if s ~= Enum.UserInputState.Begin then return end | |
local i = game:GetService("GuiService"):GetGuiInset() | |
i = Vector3.new(i.X, i.Y, 0) | |
local p = o.Position + i | |
local vp = workspace.CurrentCamera:ViewportPointToRay(p.X, p.Y) | |
local r = workspace:Raycast(vp.Origin, vp.Direction * 1000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local holsteredTools = {} | |
local function HolsterTools(attachment) | |
local player = script.Parent.Parent.Parent | |
if not player:IsA("Player") then return end | |
local character = player.Character | |
if not character then return end | |
local tool = character:FindFirstChild(script.Parent.Name) |