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
function testNil() return nil end | |
function testNothing() end | |
print( type( (testNil()) ) ) | |
print( type( (testNothing()) ) ) | |
print( type( testNil() ) ) | |
print( type( testNothing() ) ) |
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 Tooltip = require(game.ReplicatedStorage.Tooltip) | |
local tooltipGui = script.Parent | |
local tooltipTextLabel = tooltipGui.Text | |
local offset = Vector2.new(16, 0) | |
local maxSize = Vector2.new(200, math.huge) | |
local tooltip = Tooltip.new(tooltipGui, tooltipTextLabel, offset, maxSize) | |
tooltip:AutoShow(script.Parent.Parent) |
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 COLLISION_GROUP_ATTR_NAME = "CollisionGroup" | |
local RECURSIVE_PLAYER = true | |
local RECURSIVE_NON_PLAYER = true | |
local PhysicsService = game:GetService("PhysicsService") | |
local function IsValidCollisionGroup(collisionGroup) | |
return collisionGroup and #collisionGroup > 0 | |
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 ContextActionService = game:GetService("ContextActionService") | |
local RunService = game:GetService("RunService") | |
local player = game.Players.LocalPlayer | |
local effect = game.ReplicatedStorage.ClickToMoveEffect | |
local heartbeatSignal = nil | |
local function OnClickToMoveTick() | |
local hit = player:GetMouse().Hit | |
if not hit then return 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 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 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 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 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 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) |