instruction
stringclasses
1 value
input
stringclasses
8 values
output
stringlengths
50
15k
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local function visiblearms(bool) if armsvisible then local castshadow = not bool for i, part in ipairs(armparts) do part.LocalTransparencyModifier = armtransparency part.CanCollide = false part.CastShadow = castshadow end end end
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
function scriptChildModified(child) local fileList = animNames[child.Name] if (fileList ~= nil) then configureAnimationSet(child.Name, fileList) end end script.ChildAdded:connect(scriptChildModified) script.ChildRemoved:connect(scriptChildModified) for name, fileList in pairs(animNames) do configureAnimationSet...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local Drive={} --Power Front Wheels if _Tune.Config == "FWD" or _Tune.Config == "AWD" then for i,v in pairs(car.Wheels:GetChildren()) do if v.Name=="FL" or v.Name=="FR" or v.Name=="F" then table.insert(Drive,v) end end end --Power Rear Wheels if _Tune.Config == "RWD" or _Tune.Config == "AWD" then ...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local ClientBridge = require(script.ClientBridge) local ClientIdentifiers = require(script.ClientIdentifiers) local ClientProcess = require(script.ClientProcess) local Types = require(script.Parent.Types) local Client = {} function Client.start() ClientProcess.start() ClientIdentifiers.start() end function Client....
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
function Flip() --Detect Orientation if (car.DriveSeat.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector.y > .1 or FlipDB then FlipWait=tick() --Apply Flip else if tick()-FlipWait>=3 then FlipDB=true local gyro = car.DriveSeat.Flip gyro.maxTorque = Vector3.new(10000,0,10000) gyro.P=3000 ...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
-- function Path:Destroy() for _, event in ipairs(self._events) do event:Destroy() end self._events = nil if rawget(self, "_visualWaypoints") then self._visualWaypoints = destroyVisualWaypoints(self._visualWaypoints) end self._path:Destroy() setmetatable(self, nil) for k, _ in pairs(self) do self[k] = nil...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local function Steering() local SteerLocal = script.Parent.Values.SteerC.Value --Mouse Steer if _MSteer then local msWidth = math.max(1,mouse.ViewSizeX*_Tune.Peripherals.MSteerWidth/200) local mdZone = _Tune.Peripherals.MSteerDZone/100 local mST = ((mouse.X-mouse.ViewSizeX/2)/msWidth) if math.abs(mST)<=mdZon...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
function Prone() L_87_:FireServer("Prone") L_14_:Create(L_3_:WaitForChild('Humanoid'), TweenInfo.new(0.3), { CameraOffset = Vector3.new(0, -3, 0) }):Play() L_3_:WaitForChild("Humanoid").WalkSpeed = 4 L_127_ = 4 L_126_ = 0.025 L_47_ = true L_67_ = 0.01 L_66_ = -0.05 L_68_ = 0.05 Proned2 = Vector3.new(0...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local engineStartTween = TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.In, 0, false, 0) local Remotes = Vehicle:WaitForChild("Remotes") local SetThrottleRemote = Remotes:WaitForChild("SetThrottle") local SetThrottleConnection = nil local EngineSoundEnabled = true local TireTrailEnabled = true local...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local function WaitForChild(parent, childName) while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end return parent[childName] end
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local e=2.718281828459045 local function posvel(d,s,p0,v0,p1,v1,x) if s==0 then return p0 elseif d<1-1e-8 then local h=(1-d*d)^0.5 local c1=(p0-p1+2*d/s*v1) local c2=d/h*(p0-p1)+v0/(h*s)+(2*d*d-1)/(h*s)*v1 local co=math.cos(h*s*x) local si=math.sin(h*s*x) local ex=e^(d*s*x) return co/ex*c1+si/ex*c2+p...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local ratio = 6.1/#themeColors local themeFrame = pages.custom["AB ThemeSelection"] local themeDe = true local function updateThemeSelection(themeName, themeColor) if themeName == nil then for i,v in pairs(themeColors) do if v[1] == main.pdata.Theme then themeName = v[1] themeColor = v[2] break end...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
function wait_time(duration) local start = tick() local Heartbeat = game:GetService("RunService").Heartbeat repeat Heartbeat:Wait() until (tick() - start) >= duration return (tick() - start) end
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local DataStoreService = game:GetService("DataStoreService") local OrderedBackups = {} OrderedBackups.__index = OrderedBackups function OrderedBackups:Get() local success, value = pcall(function() return self.orderedDataStore:GetSortedAsync(false, 1):GetCurrentPage()[1] end) if not success then return false, ...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
This = script.Parent Elevator = This.Parent.Parent.Parent CustomLabel = require(This.Parent.Parent.Parent.CustomLabel) Characters = require(script.Characters) CustomText = CustomLabel["CUSTOMFLOORLABEL"] Elevator:WaitForChild("Floor").Changed:connect(function(floor) --custom indicator code-- ChangeFloor(tostring(fl...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
function keyDown(K) local Key = string.lower(K) if Key == S.Keys.lowerStance and S.canChangeStance then if (not Running) then if Stance == 0 then if S.stanceSettings.Stances.Crouch then Crouch() elseif S.stanceSettings.Stances.Prone then Prone() end elseif Stance == 1 then if S.stan...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local function ApplyTags(target) while target:FindFirstChild('creator') do target.creator:Destroy() end local creatorTagClone = CreatorTag:Clone() DebrisService:AddItem(creatorTagClone, 1.5) creatorTagClone.Parent = target end
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
function UnDigify(digit) if digit < 1 or digit > 61 then return "" elseif digit == 1 then return "1" elseif digit == 2 then return "!" elseif digit == 3 then return "2" elseif digit == 4 then return "@" elseif digit == 5 then return "3" elseif digit == 6 then return "4" elseif digit == 7 then re...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
for _, drop in pairs(DROPS:GetChildren()) do HandleDrop(drop) end local t = 0 RunService.Stepped:connect(function(_, deltaTime) t = t + deltaTime for drop, dropInfo in pairs(drops) do local offset = drop.Position - CAMERA.CFrame.p if math.abs(offset.X) < UPDATE_RANGE and math.abs(offset.Y) < UPDATE_RANGE and ...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local function getClientPlatform() -- TODO: Get input, and return Keyboard, Controller, or Touch return "Keyboard" end
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local v1 = { Died = 0, Running = 1, Swimming = 2, Climbing = 3, Jumping = 4, GettingUp = 5, FreeFalling = 6, FallingDown = 7, Landing = 8, Splash = 9 }; local v2 = nil; local v3 = {}; local l__ReplicatedStorage__4 = game:GetService("ReplicatedStorage"); local v5 = l__ReplicatedStorage__4:FindFirstChild("Defau...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local l__Ice__1 = game.Players.LocalPlayer:WaitForChild("Data"):WaitForChild("Ice"); local l__Parent__1 = script.Parent; l__Ice__1.Changed:Connect(function() if l__Ice__1.Value <= 0.9 and l__Ice__1.Value >= 1 then l__Parent__1.Crackle.Volume = 0.1; return; end; if l__Ice__1.Value <= 0.1 and l__Ice__1.Value >= 0 ...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
script.Parent.Parent.Values.RPM.Changed:connect(function() local t = 0 t = (totalPSI*20) BOVact = math.floor(t) end) script.Parent.Parent.Values.RPM.Changed:connect(function() wait(0.1) local t2 = 0 t2 = (totalPSI*20) BOVact2 = math.floor(t2) end) script.Parent.Parent.Values.RPM.Changed:connect(function() if BO...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
-- local MouseLockController = {} MouseLockController.__index = MouseLockController function MouseLockController.new() local self = setmetatable({}, MouseLockController) self.isMouseLocked = false self.savedMouseCursor = nil self.boundKeys = {Enum.KeyCode.Z} -- defaults self.mouseLockToggledEvent = Instance.new...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local SurfaceArtSelector = Roact.Component:extend("SurfaceArtSelector") SurfaceArtSelector.defaultProps = { numItemsPerPage = 3, } function SurfaceArtSelector:init() self.isAnimating = false self.position, self.updatePosition = Roact.createBinding(0) self.target, self.updateTarget = Roact.createBinding(0) self.m...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
function IconController.setGameTheme(theme) IconController.gameTheme = theme local icons = IconController.getIcons() for _, icon in pairs(icons) do icon:setTheme(theme) end end function IconController.setDisplayOrder(value) value = tonumber(value) or TopbarPlusGui.DisplayOrder TopbarPlusGui.DisplayOrder = valu...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local O = true function onClicked() if O == true then O = false One() elseif O == false then O = true Two() end end script.Parent.MouseButton1Down:connect(onClicked)
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
return function(tbl) --- Variables local found = false --- Scan local function local function Scan(v) --- Already found userdata if found then return end --- Iterate for key, value in pairs(v) do --- Already found userdata if found then return end --- Main check if type(value) == ...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
function TaskScheduler:CreateScheduler(targetFps) local scheduler = {} local queue = {} local sleeping = true local event,paused local start local frameUpdateTable = {} local sleep--get syntax highlighter to shut up on line 68 local function onEvent() local iterationStart = tick() local targetFrameUpdates ...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
for name, fileList in pairs(animNames) do animTable[name] = {} animTable[name].count = 0 animTable[name].totalWeight = 0 -- check for config values local config = script:FindFirstChild(name) if (config ~= nil) then
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local u1 = nil; coroutine.wrap(function() u1 = require(game.ReplicatedStorage:WaitForChild("Resources")); end)(); local v1 = { New = function(p1, p2, p3, p4) p2 = p2 or Color3.new(0.2, 0.2, 0.2); p3 = p3 or Enum.Font.FredokaOne; p4 = p4 or Enum.FontSize.Size18; u1.StarterGui:SetCore("ChatMakeSystemMessage", {...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local function fields(defaults) if defaults == nil then defaults = {} end return function(input) local _object = {} for _k, _v in pairs(defaults) do _object[_k] = _v end if type(input) == "table" then for _k, _v in pairs(input) do _object[_k] = _v end end return _object end end return { ...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local set = script.Settings local sp = set.Speed local enabled = set.Enabled local loop = set.Loop local debug_ = set.Debug local hum = script.Parent:WaitForChild("Humanoid") if debug_.Value == true then if hum then print("Success") else print("No Humanoid") end end local humanim = hum:LoadAnimation(script:FindF...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local DoorFX = {} local tweenService = game:GetService("TweenService") local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut) function DoorFX.OPEN(door) if not door then return end for i = 1, 2 do tweenService:Create(door["Door" .. i].PrimaryPart, tweenInfo, {CFrame = door["Door"....
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
function ServiceBag:Init() assert(not self._initializing, "Already initializing") assert(self._serviceTypesToInitializeSet, "Already initialized") self._initializing = true while next(self._serviceTypesToInitializeSet) do local serviceType = next(self._serviceTypesToInitializeSet) self._serviceTypesToInitializ...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local Pcolors = {{255, 255, 255}, {255, 180, 161}, {226, 231, 255}} local Lcolors = {{255, 255, 255}, {255, 237, 199}, {205, 227, 255}} local INDcolor = {255, 130, 80} local plactive = false local prevChild F.Setup = function(light_type, popups, tb, fog_color) event.IndicatorsAfterLeave.Disabled = true for idx, chi...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
function NpcModule.Walk(Npc, Pos, PathParams, Return) local Path = NpcModule.GetPath(Npc, Pos, PathParams) local Humanoid = Npc:FindFirstChild("Humanoid") if Path ~= false then if Humanoid then for I, Waypoint in pairs(Path:GetWaypoints()) do Humanoid:MoveTo(Waypoint.Position) Humanoid.MoveToFinished:W...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
function onRunning(speed) if speed>0 then pose = "Running" else pose = "Standing" end end function onDied() pose = "Dead" end function onJumping() pose = "Jumping" end function onClimbing() pose = "Climbing" end function onGettingUp() pose = "GettingUp" end function onFreeFall() pose = "FreeFall" end ...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local function AddRecentApp(App) if RecentAppEnabled == true then local sameapp = false if home:FindFirstChild(App) then if side.RecentApps:FindFirstChild(App) then sameapp = true end side.Status:TweenPosition(UDim2.new(0.094,0,0.638,0), "InOut", "Quint", 0.5, true) side.B1:TweenPosition(UDim2.new(0.024,...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
ScrollingFrame = NewGui('ScrollingFrame', 'ScrollingFrame') ScrollingFrame.Selectable = false ScrollingFrame.CanvasSize = UDim2.new(0, 0, 0, 0) ScrollingFrame.Parent = InventoryFrame UIGridFrame = NewGui('Frame', 'UIGridFrame') UIGridFrame.Selectable = false UIGridFrame.Size = UDim2.new(1, -(ICON_BUFFER*2), 1, 0) UIGr...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
if not shellyGood then bp.Parent,bg.Parent= nil,nil return end bp.Parent = nil wait(math.random(3,8)) end local soundBank = game.ServerStorage.Sounds.NPC.Shelly:GetChildren() shelly.Health.Changed:connect(function() if shellyGood then bp.Parent,bg.Parent= nil,nil shelly.PrimaryPart.Transparency =1 shelly.PrimaryPart....
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local KEY_BASE_FRAME = "BaseFrame" local KEY_BASE_MESSAGE = "BaseMessage" local KEY_UPDATE_TEXT_FUNC = "UpdateTextFunction" local KEY_GET_HEIGHT = "GetHeightFunction" local KEY_FADE_IN = "FadeInFunction" local KEY_FADE_OUT = "FadeOutFunction" local KEY_UPDATE_ANIMATION = "UpdateAnimFunction" local TextService = game:G...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
function RemoteSignal:Connect(fn) if self._directConnect then return self._re.OnServerEvent:Connect(fn) else return self._signal:Connect(fn) end end function RemoteSignal:_processOutboundMiddleware(player: Player?, ...: any) if not self._hasOutbound then return ... end local args = table.pack(...) for _,m...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
["Walk"] = "http://www.roblox.com/asset/?id=507767714", ["Idle"] = "http://www.roblox.com/asset/?id=507766666", ["SwingTool"] = "rbxassetid://1262318281" } local anims = {} for animName,animId in next,preAnims do local anim = Instance.new("Animation") anim.AnimationId = animId game:GetService("ContentProvider"):Preload...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
return function(data, env) if env then setfenv(1, env) end local playergui = service.PlayerGui local localplayer = service.Players.LocalPlayer local scr = client.UI.Prepare(script.Parent.Parent) local window = scr.Window local msg = data.Message local color = data.Color local found = client.UI.Get("Output"...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
bike.DriveSeat.ChildRemoved:connect(function(child) --[[if child.Name=="SeatWeld" and child:IsA("Weld") then script.Parent:Destroy() end]] bike.Body.bal.LeanGyro.D = 0 bike.Body.bal.LeanGyro.MaxTorque = Vector3.new(0,0,0) bike.Body.bal.LeanGyro.P = 0 bike.RearSection.Axle.HingeConstraint.MotorMaxTorque =...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
ha=false hd=false hs=false hw=false imgassets ={ hazardoff="http://www.roblox.com/asset/?id=216957891", hazardon = "http://www.roblox.com/asset/?id=216957887", leftyoff = "http://www.roblox.com/asset/?id=216957962", leftyon = "http://www.roblox.com/asset/?id=216957949", rightyoff = "http://www.roblox.com/asset/?id...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local function Flip() --Detect Orientation if (car.DriveSeat.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector.y > .1 or FlipDB then FlipWait=tick() --Apply Flip else if tick()-FlipWait>=3 then FlipDB=true local gyro = car.DriveSeat.Flip gyro.maxTorque = Vector3.new(10000,0,10000) gyro.P=3000 gyr...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local function onProductPurchased(player, id) local product, class = getAsset(id) if product then local data = Datastore:GetData(player) if product.onPurchased then product.onPurchased(player) end if class == "Passes" and data then local gamepasses = data.Gamepasses or {} table.insert(gamepasses, p...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
amplitude = 0.1 frequency = 1 setAngles = true end if (setAngles) then local desiredAngle = amplitude * math.sin(time * frequency) RightShoulder:SetDesiredAngle(desiredAngle + climbFudge) LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge) RightHip:SetDesiredAngle(-desiredAngle) LeftHip:SetDesired...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local function toggleDoor(player, door) -- Check distance to the character's Torso. If too far, don't do anything if player.Character and player.Character:FindFirstChild("Torso") then local torso = player.Character:FindFirstChild("Torso") local toTorso = torso.Position - stove.Door.Position if toTorso.magnitud...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
_diff_cleanupSemanticLossless = function(diffs: Array<Diff>) local pointer = 2 -- Intentionally ignore the first and last element (don't need checking). while diffs[pointer + 1] do local prevDiff, nextDiff = diffs[pointer - 1], diffs[pointer + 1] if prevDiff[1] == DIFF_EQUAL and nextDiff[1] == DIFF_EQUAL then ...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
function ActionManager:BindGameActions(players) for i, player in pairs(players) do bind:FireClient(player, "Action1", Enum.UserInputType.MouseButton1, Enum.KeyCode.ButtonR2) end end function ActionManager:UnbindGameActions(players) for i, player in pairs(players) do unbind:FireClient(player, "Action1") end end
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local function makeProperty(valueObjectClass, defaultValue, setter) local valueObject = Instance.new(valueObjectClass) if defaultValue then valueObject.Value = defaultValue end valueObject.Changed:connect(setter) setter(valueObject.Value) return valueObject end local Color = makeProperty("Color3Value", RAIN_DE...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
-- local function validateAndSendSoundRequest(requestingPly, parent, soundObj, vol, pit, timePos) if not soundObj then return end for _, v in pairs(serverWorkerModule.getAllOtherPlayers(requestingPly)) do playSoundEffectEvent:FireClient(v, parent, soundObj, vol, pit, timePos) end end
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local triggerEnabled = true local function touched(otherPart) if( not triggerEnabled ) then return end if(otherPart.Name == "HumanoidRootPart" ) then local player = game.Players:FindFirstChild(otherPart.Parent.Name) if(player) then triggerEnabled = false staticCorrupt.Transparency = 0 imageLableCorru...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
function onRunning(speed) if isSeated then return end if speed>0 then pose = "Running" else pose = "Standing" end end function onDied() pose = "Dead" end function onJumping() isSeated = false pose = "Jumping" end function onClimbing() pose = "Climbing" end function onGettingUp() pose = "GettingUp" end...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
-- function DPad:Enable() DPadFrame.Visible = true end function DPad:Disable() DPadFrame.Visible = false OnInputEnded() end function DPad:Create(parentFrame) if DPadFrame then DPadFrame:Destroy() DPadFrame = nil end local position = UDim2.new(0, 10, 1, -230) DPadFrame = Instance.new('Frame') DPadFrame.Na...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
script.Parent:WaitForChild("A-Chassis Interface") script.Parent:WaitForChild("Plugins") script.Parent:WaitForChild("README") local car=script.Parent.Parent local _Tune=require(script.Parent) wait(_Tune.LoadDelay) --Weight Scaling local weightScaling = _Tune.WeightScaling if not workspace:PGSIsEnabled() then ...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
game:GetService("Players").LocalPlayer.Chatted:connect(function(msg) local emote = "" if (string.sub(msg, 1, 3) == "/e ") then emote = string.sub(msg, 4) elseif (string.sub(msg, 1, 7) == "/emote ") then emote = string.sub(msg, 8) end if (pose == "Standing" and emoteNames[emote] ~= nil) then playAnimation(em...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
function Receive(player, action, ...) local args = {...} if player == User and action == "play" then Connector:FireAllClients("play", User, args[1], Settings.SoundSource.Position, Settings.PianoSoundRange, Settings.PianoSounds, args[2], Settings.IsCustom) HighlightPianoKey((args[1] > 61 and 61) or (args[1] < 1 an...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local function GetTeamFromColor(teamColor) for _, team in ipairs(Teams:GetTeams()) do if team.TeamColor == teamColor then return team end end return nil end
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
WindShake:SetDefaultSettings(WindShakeSettings) WindShake:Init() for _, ShakeObject in pairs(game.Workspace:GetDescendants()) do if ShakeObject:IsA("BasePart") then if table.find(ShakableObjects, ShakeObject.Name) then WindShake:AddObjectShake(ShakeObject, WindShakeSettings) end end end game.Workspace.Desce...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
function GoTo(Target) Path:ComputeAsync(NPC.HumanoidRootPart.Position, Target) if Path.Status == Enum.PathStatus.NoPath then else local WayPoints = Path:GetWaypoints() for _, WayPoint in ipairs(WayPoints) do NPC.Humanoid:MoveTo(WayPoint.Position) if WayPoint.Action == Enum.PathWaypointAction.Jump then ...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
camera.Changed:connect(function() local dis = (game.Lighting:GetSunDirection()-camera.CoordinateFrame.lookVector).magnitude local parts = camera:GetPartsObscuringTarget({camera.CoordinateFrame,game.Lighting:GetSunDirection()*10000},{((camera.CoordinateFrame.p-player.Character.Head.Position).magnitude < 1 and player.C...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local k = 0.5 local lowerK = 0.9 local function SCurveTransform(t) t = math.clamp(t, -1,1) if t >= 0 then return (k*t) / (k - t + 1) end return -((lowerK*-t) / (lowerK + t + 1)) end local DEADZONE = 0.25 local function toSCurveSpace(t) return (1 + DEADZONE) * (2*math.abs(t) - 1) - DEADZONE end local function f...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local methods = {} methods.__index = methods local function CreateGuiObjects() local BaseFrame = Instance.new("Frame") BaseFrame.Selectable = false BaseFrame.Size = UDim2.new(1, 0, 1, 0) BaseFrame.BackgroundTransparency = 1 local Scroller = Instance.new("ScrollingFrame") Scroller.Selectable = ChatSettings.Gamep...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
if year == 2007 then script.Parent.ClickToChat.TextColor3 = Color3.new(0, 0, 0) script.Parent.ChatBar.BackgroundColor3 = Color3.new(255/255, 255/255, 255/255) end local Chat = { ChatColors = { BrickColor.new("Bright red"), BrickColor.new("Bright blue"), BrickColor.new("Earth green"), BrickColor.new("Bright ...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
if backfire == true then mouse.KeyDown:connect(function(key) if key == camkey and enabled == false then local children = car.Body.Exhaust:GetChildren() for index, child in pairs(children) do if child.Name == "Backfire1" or child.Name == "Backfire2" then local effect = script.soundeffect:Clone(...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local MovementMap = { [Enum.KeyCode.W] = Vector3.new(0, 0, -1); [Enum.KeyCode.A] = Vector3.new(-1, 0, 0); [Enum.KeyCode.S] = Vector3.new(0, 0, 1); [Enum.KeyCode.D] = Vector3.new(1, 0, 0) } local Maid local MovementController = {} function MovementController:GetInput() local totalVector = Vector3....
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
function Promise:Yield() if self._fulfilled then return true, unpack(self._fulfilled, 1, self._valuesLength) elseif self._rejected then return false, unpack(self._rejected, 1, self._valuesLength) else local bindable = Instance.new("BindableEvent") self:Then(function() bindable:Fire() end, function() ...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
function onClicked() Option() end script.Parent.MouseButton1Down:connect (onClicked)
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
function Janitor.__index:Add(Object, MethodName, Index) if Index then self:Remove(Index) local This = self[IndicesReference] if not This then This = {} self[IndicesReference] = This end This[Index] = Object end MethodName = MethodName or TypeDefaults[typeof(Object)] or "Destroy" if type(Object) ~...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local function GetAnimationFromChord(chord: number, hold: boolean): Animation if hold then return AnimationsDB.Sustain end if chord == 1 then return AnimationsDB.SpecialA elseif chord == 2 then return AnimationsDB.SpecialB elseif chord == 3 then return AnimationsDB.SpecialC end return AnimationsDB.Spec...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
if BlockPosition == 1 then Block.CFrame = Pos1 end if BlockPosition == 2 then Block.CFrame = Pos2 end if BlockPosition == 3 then Block.CFrame = Pos3 end if BlockPosition == 4 then Block.CFrame = Pos4 end
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
Zombie.Humanoid.Died:Connect(function() script.Parent:Destroy() end) Zombie.Humanoid.HealthChanged:Connect(function() Zombie.Damage = math.ceil((script.Parent.Humanoid.Health * 1.2) / 2) end)
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
mouse.KeyDown:connect(function(key) if key=="m" then veh.Lightbar.middle.Beep:Play() veh.Lightbar.Remotes.AllyEvent:FireServer(true) end end)
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local plr = script.Parent.Parent.Parent local autoclick = false local autoclickDD = false function GetAuto() game.Workspace.Tree.Size = game.Workspace.Tree.Size + Vector3.new(1,1,1) game.Workspace.Base.Size = game.Workspace.Base.Size + Vector3.new(1,0,1) game.Workspace.Pop:Play() end script.Parent.AutoClick.MouseB...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
while game:GetService("RunService").Heartbeat:wait() and car:FindFirstChild("DriveSeat") and character.Humanoid.SeatPart == car.DriveSeat do --game:GetService("RunService").RenderStepped:wait() if IsGrounded() then if movement.Y ~= 0 then local velocity = humanoidRootPart.CFrame.lookVector * movement.Y * sta...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
while true do while Humanoid.Health < Humanoid.MaxHealth do local dt = wait(REGEN_STEP) local dh = dt*REGEN_RATE*Humanoid.MaxHealth Humanoid.Health = math.min(Humanoid.Health + dh, Humanoid.MaxHealth) end Humanoid.HealthChanged:Wait() end
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local function toggleWindow(button) local windowName = button.Name -- Find the corresponding frame in the AppManager using the window name local window = gui:FindFirstChild(windowName) if window then if window.Visible == false then -- Close other windows for _, child in ipairs(gui:GetChildren()) do if ...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local maxChunkSize = 100 * 1000 local ApiJson if script:FindFirstChild("RawApiJson") then ApiJson = script.RawApiJson else ApiJson = "" end local jsonToParse = require(ApiJson) function getRbxApi()
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
elseif sv.Value==5 then while s.Pitch<1 do s.Pitch=s.Pitch+0.010 s:Play() if s.Pitch>1 then s.Pitch=1 end wait(-9) end while true do for x = 1, 500 do s:play() wait(-9) end wait() end
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
function Table.swapKeyValue(orig) local tab = {} for key, val in pairs(orig) do tab[val] = key end return tab end
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
function JsonToLocalizationTable.getOrCreateLocalizationTable() local localizationTable = LocalizationService:FindFirstChild(LOCALIZATION_TABLE_NAME) if not localizationTable then localizationTable = Instance.new("LocalizationTable") localizationTable.Name = LOCALIZATION_TABLE_NAME if RunService:IsRunning() t...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
function ExternalEventConnection:render() return Roact.oneChild(self.props[Roact.Children]) end function ExternalEventConnection:didMount() local event = self.props.event local callback = self.props.callback self.connection = event:Connect(callback) end function ExternalEventConnection:didUpdate(oldProps) if se...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
function ClientRemoteSignal:Connect(fn) if self._directConnect then return self._re.OnClientEvent:Connect(fn) else return self._signal:Connect(fn) end end
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end)) table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end)) local idx = 1 for _, childPart in pairs(config:GetChildr...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
function TestPlan:addRoot(path, method) local curNode = self for i = #path, 1, -1 do local nextNode = nil for _, child in ipairs(curNode.children) do if child.phrase == path[i] then nextNode = child break end end if nextNode == nil then nextNode = curNode:addChild(path[i], TestEnum.NodeType...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local anim = animTable[animName][idx].anim -- load it to the humanoid; get AnimationTrack toolOldAnimTrack = toolAnimTrack toolAnimTrack = humanoid:LoadAnimation(anim) -- play the animation toolAnimTrack:Play(transitionTime) toolAnimName = animName currentToolAnimKeyframeHandler = toolAnimTrack.Keyfram...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
function Gamepad:GetHighestPriorityGamepad() local connectedGamepads = UserInputService:GetConnectedGamepads() local bestGamepad = NONE -- Note that this value is higher than all valid gamepad values for _, gamepad in pairs(connectedGamepads) do if gamepad.Value < bestGamepad.Value then bestGamepad = gamepad ...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local function Truncate(tbl: Table, len: number): Table local n = #tbl len = math.clamp(len, 1, n) if len == n then return table.clone(tbl) end return table.move(tbl, 1, len, 1, table.create(len)) end
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
function Handler:add(hitboxObject) assert(typeof(hitboxObject) ~= "Instance", "Make sure you are initializing from the Raycast module, not from this handler.") table.insert(ActiveHitboxes, hitboxObject) end function Handler:remove(object) for i in ipairs(ActiveHitboxes) do if ActiveHitboxes[i].object == object th...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local hitPart = script.Parent local debounce = true local tool = game.ServerStorage.Floral -- Change "Sword" to the name of your tool, make sure your tool is in ServerStorage hitPart.Touched:Connect(function(hit) if debounce == true then if hit.Parent:FindFirstChild("Humanoid") then local plr = game.Players:Find...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
function Immutable.Append(list, ...) local new = {} local len = #list for key = 1, len do new[key] = list[key] end for i = 1, select("#", ...) do new[len + i] = select(i, ...) end return new end
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
local player=game.Players.LocalPlayer local mouse=player:GetMouse() local car = script.Parent.Parent.Car.Value local _Tune = require(car["A-Chassis Tune"]) local gauges = script.Parent local values = script.Parent.Parent.Values local isOn = script.Parent.Parent.IsOn gauges:WaitForChild("Speedo") gauges:WaitForChild(...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
debounce = true function onTouched(hit) if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then debounce = false h = Instance.new("Hat") p = Instance.new("Part") h.Name = "2006 Visor" p.Parent = h p.Position = hit.Parent:findFirstChild("Head").Position p.Name = "Handle" p.formFacto...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
for i, channelData in pairs(initData.Channels) do if channelData[1] == ChatSettings.GeneralChannelName then HandleChannelJoined(channelData[1], channelData[2], channelData[3], channelData[4], true, false) end end for i, channelData in pairs(initData.Channels) do if channelData[1] ~= ChatSettings.GeneralChannelNam...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
-- function Path.new(agent, agentParameters, override) if not (agent and agent:IsA("Model") and agent.PrimaryPart) then output(error, "Pathfinding agent must be a valid Model Instance with a set PrimaryPart.") end local self = setmetatable({ _settings = override or DEFAULT_SETTINGS; _events = { Reached = I...
Explain this Roblox Luau script.
Source: Roblox/luau_corpus
function ObservableSubscriptionTable:Observe(key) assert(key ~= nil, "Bad key") return Observable.new(function(sub) if not self._subMap[key] then self._subMap[key] = { sub } else table.insert(self._subMap[key], sub) end return function() if not self._subMap[key] then return end local cur...