prompt
stringlengths
2
14.7k
completion
stringlengths
1
99.7k
-- Decompiled with the Synapse X Luau decompiler.
local v1 = script:FindFirstAncestor("MainUI"); local v2 = require(script.Parent); local v3 = require(game.Players.LocalPlayer:WaitForChild("PlayerScripts"):WaitForChild("PlayerModule")):GetControls(); local v4 = game["Run Service"]; local l__UserInputService__5 = game:GetService("UserInputService"); local l__Parent__1 = script.Parent.Parent.Parent; local l__TweenService__2 = game:GetService("TweenService"); game:GetService("ReplicatedStorage").Bricks.Caption.OnClientEvent:Connect(function(p7, p8) v2.caption(p7, p8); end);
--- Overwrites an existing table -- @tparam table target Table to overwite -- @tparam table source Source table to read from -- @treturn table target
function Table.overwrite(target, source) for index, item in pairs(source) do target[index] = item end return target end
-- Local Functions
local function StartIntermission() -- Find flag to circle. Default to circle center of map local possiblePoints = {} table.insert(possiblePoints, Vector3.new(0,50,0)) for _, child in ipairs(game.Workspace:GetChildren()) do if child.Name == "FlagStand" then table.insert(possiblePoints, child.FlagStand.Position) end end local focalPoint = possiblePoints[math.random(#possiblePoints)] Camera.CameraType = Enum.CameraType.Scriptable Camera.Focus = CFrame.new(focalPoint) local angle = 0 Lighting.Blur.Enabled = true RunService:BindToRenderStep('IntermissionRotate', Enum.RenderPriority.Camera.Value, function() local cameraPosition = focalPoint + Vector3.new(50 * math.cos(angle), 20, 50 * math.sin(angle)) Camera.CoordinateFrame = CFrame.new(cameraPosition, focalPoint) angle = angle + math.rad(.25) end) end local function StopIntermission() Lighting.Blur.Enabled = false RunService:UnbindFromRenderStep('IntermissionRotate') Camera.CameraType = Enum.CameraType.Custom end local function OnDisplayIntermission(display) if display and not InIntermission then InIntermission = true StartIntermission() end if not display and InIntermission then InIntermission = false StopIntermission() end end
-- Waits for the child of the specified parent
local function WaitForChild(parent, childName) while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end return parent[childName] end local Tool = script.Parent local Handle = WaitForChild(Tool, 'Handle') local Debounce = false local TouchConnection function OnTouched(hit) local humanoid = hit.Parent:findFirstChild('Humanoid') if Debounce == false then Debounce = true if humanoid then else Handle.Ting:Play() end end wait(0.5) Debounce = false end Tool.Equipped:connect(function() TouchConnection = Handle.Touched:connect(OnTouched) end) Tool.Unequipped:connect(function() if TouchConnection then TouchConnection:disconnect() TouchConnection = nil end end)
--[[ Services ]]
-- local ContextActionService = game:GetService('ContextActionService') local Players = game:GetService('Players') local UserInputService = game:GetService('UserInputService') local VRService = game:GetService('VRService')
--------| Setting |--------
local displayZ = 10
--[[[Default Controls]]
--Peripheral Deadzones Tune.Peripherals = { MSteerWidth = 67 , -- Mouse steering control width (0 - 100% of screen width) MSteerDZone = 0 , -- Mouse steering deadzone (0 - 100%) ControlLDZone = 5 , -- Controller steering L-deadzone (0 - 100%) ControlRDZone = 5 , -- Controller steering R-deadzone (0 - 100%) } --Control Mapping Tune.Controls = { --Keyboard Controls --Mode Toggles ToggleTCS = nil , ToggleABS = nil , ToggleTransMode = nil , ToggleMouseDrive = nil , --Primary Controls Throttle = Enum.KeyCode.Up , Brake = Enum.KeyCode.Down , SteerLeft = Enum.KeyCode.Left , SteerRight = Enum.KeyCode.Right , --Secondary Controls Throttle2 = Enum.KeyCode.W , Brake2 = Enum.KeyCode.S , SteerLeft2 = Enum.KeyCode.A , SteerRight2 = Enum.KeyCode.D , --Manual Transmission ShiftUp = Enum.KeyCode.E , ShiftDown = Enum.KeyCode.Q , Clutch = Enum.KeyCode.LeftShift , --Handbrake PBrake = Enum.KeyCode.P , --Mouse Controls MouseThrottle = Enum.UserInputType.MouseButton1 , MouseBrake = Enum.UserInputType.MouseButton2 , MouseClutch = Enum.KeyCode.W , MouseShiftUp = Enum.KeyCode.E , MouseShiftDown = Enum.KeyCode.Q , MousePBrake = Enum.KeyCode.LeftShift , --Controller Mapping ContlrThrottle = Enum.KeyCode.ButtonR2 , ContlrBrake = Enum.KeyCode.ButtonL2 , ContlrSteer = Enum.KeyCode.Thumbstick1 , ContlrShiftUp = Enum.KeyCode.ButtonY , ContlrShiftDown = Enum.KeyCode.ButtonX , ContlrClutch = Enum.KeyCode.ButtonR1 , ContlrPBrake = Enum.KeyCode.ButtonL1 , ContlrToggleTMode = Enum.KeyCode.DPadUp , ContlrToggleTCS = Enum.KeyCode.DPadDown , ContlrToggleABS = Enum.KeyCode.DPadRight , }
-- Set defaults
Frame.defaultProps = { BackgroundTransparency = 1, BorderSizePixel = 0, Size = UDim2.new(1, 0, 1, 0) } function Frame:render() local props = Support.CloneTable(self.props) local state = self.state -- Include aspect ratio constraint if specified if props.AspectRatio then local Constraint = new('UIAspectRatioConstraint', { AspectRatio = props.AspectRatio }) -- Insert constraint into children props[Roact.Children] = Support.Merge( { AspectRatio = Constraint }, props[Roact.Children] or {} ) -- Base height off width using the aspect ratio if props.DominantAxis == 'Width' then props.SizeConstraint = 'RelativeXX' if typeof(props.Width) == 'UDim' then props.Height = UDim.new(props.Width.Scale / props.AspectRatio, 0) else props.Size = UDim2.new( props.Size.X, UDim.new(props.Size.X.Scale / props.AspectRatio, 0) ) end -- Base width off height using the aspect ratio elseif props.DominantAxis == 'Height' then props.SizeConstraint = 'RelativeYY' if typeof(props.Height) == 'UDim' then props.Width = UDim.new(props.Height.Scale * props.AspectRatio, 0) else props.Size = UDim2.new( UDim.new(props.Size.Y.Scale * props.AspectRatio, 0), props.Size.Y ) end end end -- Include list layout if specified if props.Layout == 'List' then local Layout = new('UIListLayout', { FillDirection = props.LayoutDirection, Padding = props.LayoutPadding, HorizontalAlignment = props.HorizontalAlignment, VerticalAlignment = props.VerticalAlignment, SortOrder = props.SortOrder or 'LayoutOrder', [Roact.Ref] = function (rbx) self:UpdateContentSize(rbx) end, [Roact.Change.AbsoluteContentSize] = function (rbx) self:UpdateContentSize(rbx) end }) -- Update size props.Size = self:GetSize() -- Insert layout into children props[Roact.Children] = Support.Merge( { Layout = Layout }, props[Roact.Children] ) end -- Filter out custom properties props.AspectRatio = nil props.DominantAxis = nil props.Layout = nil props.LayoutDirection = nil props.LayoutPadding = nil props.HorizontalAlignment = nil props.VerticalAlignment = nil props.HorizontalPadding = nil props.VerticalPadding = nil props.SortOrder = nil props.Width = nil props.Height = nil props.ResizeParent = nil -- Display component in wrapper return new('Frame', props) end function Frame:GetSize(ContentSize) local props = self.props -- Determine dynamic dimensions local DynamicWidth = props.Size == 'WRAP_CONTENT' or props.Width == 'WRAP_CONTENT' local DynamicHeight = props.Size == 'WRAP_CONTENT' or props.Height == 'WRAP_CONTENT' local DynamicSize = DynamicWidth or DynamicHeight -- Get padding from props local Padding = UDim2.new( 0, props.HorizontalPadding or 0, 0, props.VerticalPadding or 0 ) -- Calculate size based on content if dynamic return Padding + UDim2.new( (ContentSize and DynamicWidth) and UDim.new(0, ContentSize.X) or (typeof(props.Width) == 'UDim' and props.Width or props.Size.X), (ContentSize and DynamicHeight) and UDim.new(0, ContentSize.Y) or (typeof(props.Height) == 'UDim' and props.Height or props.Size.Y) ) end function Frame:UpdateContentSize(Layout) if not (Layout and Layout.Parent) then return end -- Set container size based on content Layout.Parent.Size = self:GetSize(Layout.AbsoluteContentSize) -- Set parent size based on content if specified local ResizeParent = self.props.ResizeParent local Parent = ResizeParent and Layout.Parent.Parent if ResizeParent and Parent then local ParentWidth = Parent.Size.X local ParentHeight = Parent.Size.Y if Support.IsInTable(ResizeParent, 'WIDTH') then ParentWidth = UDim.new(0, Layout.Parent.AbsoluteSize.X) end if Support.IsInTable(ResizeParent, 'HEIGHT') then ParentHeight = UDim.new(0, Layout.Parent.AbsoluteSize.Y) end Parent.Size = UDim2.new(ParentWidth, ParentHeight) end end return Frame
-- ROBLOX deviation: Roblox Instance matchers
local RobloxShared = require(Packages.RobloxShared) local instanceSubsetEquality = RobloxShared.RobloxInstance.instanceSubsetEquality local getInstanceSubset = RobloxShared.RobloxInstance.getInstanceSubset
--print("light loaded")
local light = script.Parent while true do light.Transparency = 0.9 wait(5) light.Transparency = 0.7 wait(1) light.Transparency = 0.5 wait(1) light.Transparency = 0.3 wait(1) light.Transparency = 0.1 wait(2) light.Transparency = 1 wait(7) end
----- MAGIC NUMBERS ABOUT THE TOOL ----- -- How much damage a bullet does
local Damage = 5
-- Movement mode standardized to Enum.ComputerCameraMovementMode values
function BaseCamera:SetCameraMovementMode( cameraMovementMode ) self.cameraMovementMode = cameraMovementMode end function BaseCamera:GetCameraMovementMode() return self.cameraMovementMode end function BaseCamera:SetIsMouseLocked(mouseLocked) self.inMouseLockedMode = mouseLocked self:UpdateMouseBehavior() end function BaseCamera:GetIsMouseLocked() return self.inMouseLockedMode end function BaseCamera:SetMouseLockOffset(offsetVector) self.mouseLockOffset = offsetVector end function BaseCamera:GetMouseLockOffset() return self.mouseLockOffset end function BaseCamera:InFirstPerson() return self.inFirstPerson end function BaseCamera:EnterFirstPerson() -- Overridden in ClassicCamera, the only module which supports FirstPerson end function BaseCamera:LeaveFirstPerson() -- Overridden in ClassicCamera, the only module which supports FirstPerson end
--[=[ Promises a Roblox datastore object with the name and scope. Generally only fails when you haven't published the place. @param name string @param scope string @return Promise<DataStore> ]=]
function DataStorePromises.promiseDataStore(name, scope) assert(type(name) == "string", "Bad name") assert(type(scope) == "string", "Bad scope") return Promise.new(function(resolve, reject) local result = nil local ok, err = pcall(function() result = DataStoreService:GetDataStore(name, scope) end) if not ok then return reject(err) end return resolve(result) end) end
--Service
local RunService = game:GetService("RunService") return function(obj, text, duration) local length = #text local interval = duration / length local con, lastUpdate, currentPos = nil, time(), 1 con = RunService.RenderStepped:Connect(function() if time() - lastUpdate > interval then currentPos += 1 obj.Text = string.sub(text, 1, currentPos) lastUpdate = time() if currentPos == length then con:Disconnect() 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 AllowDisableCustomAnimsUserFlag = false local success, msg = pcall(function() AllowDisableCustomAnimsUserFlag = UserSettings():IsUserFeatureEnabled("UserAllowDisableCustomAnims2") end) if AllowDisableCustomAnimsUserFlag then local success, msg = pcall(function() allowCustomAnimations = game:GetService("StarterPlayer").AllowCustomAnimations end) if not success then allowCustomAnimations = true end 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 if PreloadAnimsUserFlag then for i, animType in pairs(animTable) do for idx = 1, animType.count, 1 do Humanoid:LoadAnimation(animType[idx].anim) end end end end
--[[while wait(2) do local t = tick() script.Parent.PingRemote:InvokeServer() local ping = ((tick() - t) / 2) * 1000 -- time it takes in milliseconds local txt = string.format("Ping : %dms", ping) if ping > 130 then txt = string.format("%s (Warning high ping)",txt) end txt = string.format("%s Server location: %s",txt, script.Parent.PingLocation.Value) script.Parent.Text = txt end]]
while wait(2) do local t = tick() script.Parent.PingRemote:InvokeServer() local ping = ((tick() - t) / 2) * 1000 -- time it takes in milliseconds local txt = string.format("%d ms", ping * 2) script.Parent.Text = txt end
-- Main enemy loop
function Enemy:start() coroutine.wrap(function() self._active = true while(self._active) do self:_update() wait(UPDATE_TIME_INTERVAL) end end)() end function Enemy:stop() self._active = false self._model.Humanoid.WalkSpeed = 0 end function Enemy:_destroy() self._model:Destroy() end function Enemy:_onTouch(otherPart) if self._active and CollectionService:HasTag(otherPart, "Platform") then hitPlatformEvent:Fire() self:stop() self:_destroy() end end return Enemy
-- Hi, its Avi8or!
l:SetMinutesAfterMidnight(l:GetMinutesAfterMidnight()+.02) wait(.1) end
--[[ Create a promise that represents the immediately rejected value. ]]
function Promise.reject(value) return Promise.new(function(_, reject) reject(value) end) end
-- << COMMANDS >>
local module = { ----------------------------------- { Name = "votekick"; Aliases = {}; Prefixes = {settings.Prefix}; Rank = 2; RankLock = false; Loopable = false; Tags = {}; Description = "votekick players! "; Contributors = {}; -- Args = {}; Function = function(speaker, args) end; UnFunction = function(speaker, args) end; -- }; ----------------------------------- { Name = ""; Aliases = {}; Prefixes = {settings.Prefix}; Rank = 1; RankLock = false; Loopable = false; Tags = {}; Description = ""; Contributors = {}; -- Args = {}; --[[ ClientCommand = true; FireAllClients = true; BlockWhenPunished = true; PreFunction = function(speaker, args) end; Function = function(speaker, args) wait(1) end; --]] -- }; ----------------------------------- }; return module
--------END CREW--------
end script.Parent.ClickDetector.MouseClick:connect(onClicked)
--// Damage Settings
BaseDamage = 13; -- Torso Damage LimbDamage = 10; -- Arms and Legs ArmorDamage = 10; -- How much damage is dealt against armor (Name the armor "Armor") HeadDamage = 18; -- If you set this to 100, there's a chance the player won't die because of the heal script
-- else print("Didn't hit Target")
end if makeRays then makeRay(CFrame.new(origPos, position) * CFrame.new(0, 0, -distance/2), Vector3.new(0.2, 0.2, distance)) end end end end end end round:remove() break end wait() end if round then round:remove() end script:remove()
-- Members --
elseif (itemType == 'Property') then table.insert(Classes[item.Class].Properties, item) elseif (itemType == 'Function') then table.insert(Classes[item.Class].Functions, item) elseif (itemType == 'YieldFunction') then table.insert(Classes[item.Class].YieldFunctions, item) elseif (itemType == 'Event') then table.insert(Classes[item.Class].Events, item) elseif (itemType == 'Callback') then table.insert(Classes[item.Class].Callbacks, item)
--[[ Utility Functions ]]
-- local function IsFinite(num) return num == num and num ~= 1/0 and num ~= -1/0 end local function IsFiniteVector3(vec3) return IsFinite(vec3.x) and IsFinite(vec3.y) and IsFinite(vec3.z) end local movementUpdateEvent = Instance.new("BindableEvent") movementUpdateEvent.Name = "MovementUpdate" movementUpdateEvent.Parent = script coroutine.wrap(function() local PathDisplayModule = script.Parent:WaitForChild("PathDisplay") if PathDisplayModule then PathDisplay = require(PathDisplayModule) end end)()
--Precalculated paths
local t,f,n=true,false,{} local r={ [58]={{36,37,35,39,41,30,56,58},t}, [49]={{36,33,32,31,29,28,44,45,49},t}, [16]={n,f}, [19]={{36,37,35,39,41,30,56,58,20,19},t}, [59]={{36,37,35,39,41,59},t}, [63]={{36,37,35,39,41,30,56,58,23,62,63},t}, [34]={{36,37,35,34},t}, [21]={{36,37,35,39,41,30,56,58,20,21},t}, [48]={{36,33,32,31,29,28,44,45,49,48},t}, [27]={{36,33,32,31,29,28,27},t}, [14]={n,f}, [31]={{36,33,32,31},t}, [56]={{36,37,35,39,41,30,56},t}, [29]={{36,33,32,31,29},t}, [13]={n,f}, [47]={{36,33,32,31,29,28,44,45,49,48,47},t}, [12]={n,f}, [45]={{36,33,32,31,29,28,44,45},t}, [57]={{36,37,35,39,41,30,56,57},t}, [36]={{36},t}, [25]={{36,33,32,31,29,28,27,26,25},t}, [71]={{36,37,35,39,41,59,61,71},t}, [20]={{36,37,35,39,41,30,56,58,20},t}, [60]={{36,37,35,39,41,60},t}, [8]={n,f}, [4]={n,f}, [75]={{36,37,35,39,41,59,61,71,72,76,73,75},t}, [22]={{36,37,35,39,41,30,56,58,20,21,22},t}, [74]={{36,37,35,39,41,59,61,71,72,76,73,74},t}, [62]={{36,37,35,39,41,30,56,58,23,62},t}, [1]={n,f}, [6]={n,f}, [11]={n,f}, [15]={n,f}, [37]={{36,37},t}, [2]={n,f}, [35]={{36,37,35},t}, [53]={{36,33,32,31,29,28,44,45,49,48,47,52,53},t}, [73]={{36,37,35,39,41,59,61,71,72,76,73},t}, [72]={{36,37,35,39,41,59,61,71,72},t}, [33]={{36,33},t}, [69]={{36,37,35,39,41,60,69},t}, [65]={{36,37,35,39,41,30,56,58,20,19,66,64,65},t}, [26]={{36,33,32,31,29,28,27,26},t}, [68]={{36,37,35,39,41,30,56,58,20,19,66,64,67,68},t}, [76]={{36,37,35,39,41,59,61,71,72,76},t}, [50]={{36,33,32,31,29,28,44,45,49,48,47,50},t}, [66]={{36,37,35,39,41,30,56,58,20,19,66},t}, [10]={n,f}, [24]={{36,33,32,31,29,28,27,26,25,24},t}, [23]={{36,37,35,39,41,30,56,58,23},t}, [44]={{36,33,32,31,29,28,44},t}, [39]={{36,37,35,39},t}, [32]={{36,33,32},t}, [3]={n,f}, [30]={{36,37,35,39,41,30},t}, [51]={{36,33,32,31,29,28,44,45,49,48,47,50,51},t}, [18]={n,f}, [67]={{36,37,35,39,41,30,56,58,20,19,66,64,67},t}, [61]={{36,37,35,39,41,59,61},t}, [55]={{36,33,32,31,29,28,44,45,49,48,47,52,53,54,55},t}, [46]={{36,33,32,31,29,28,44,45,49,48,47,46},t}, [42]={{36,37,35,38,42},t}, [40]={{36,37,35,40},t}, [52]={{36,33,32,31,29,28,44,45,49,48,47,52},t}, [54]={{36,33,32,31,29,28,44,45,49,48,47,52,53,54},t}, [43]={n,f}, [7]={n,f}, [9]={n,f}, [41]={{36,37,35,39,41},t}, [17]={n,f}, [38]={{36,37,35,38},t}, [28]={{36,33,32,31,29,28},t}, [5]={n,f}, [64]={{36,37,35,39,41,30,56,58,20,19,66,64},t}, } return r
--[[ _____ _ _ _ _ / ____(_) | | /\ | | (_) | (___ _ _ __ ___ _ __ | | ___ / \ __| |_ __ ___ _ _ __ \___ \| | '_ ` _ \| '_ \| |/ _ \ / /\ \ / _` | '_ ` _ \| | '_ \ ____) | | | | | | | |_) | | __// ____ \ (_| | | | | | | | | | | |_____/|_|_| |_| |_| .__/|_|\___/_/ \_\__,_|_| |_| |_|_|_| |_| | | |_| --]]
local Config = { DebugMode = false; -- Loads the MainModule (parented to the Loader) rather than the live asset. Asset = 5300444087; Settings = require(script.Parent.Parent:WaitForChild("Settings")) } if not _G.SimpleAdminLoaded then script.Parent.Parent.Parent = game:GetService("ServerScriptService") _G.SimpleAdmin = script.Parent.Parent local Start = tick() local Module = require((Config.DebugMode) and script:WaitForChild("MainModule") or Config.Asset) if Module(Config.Settings) then _G.SimpleAdminLoaded = true; warn("SimpleAdmin Loaded! (" .. tick() - Start .. " seconds)") else warn("Something went wrong while loading SimpleAdmin.") end else local Model = script.Parent.Parent.Parent.Parent if Model:IsA("Model") and Model.Name == "SimpleAdmin" then Model:Destroy() end end
-- @preconditions: vec should be a unit vector, and 0 < rayLength <= 1000
function RayCast(startPos, vec, rayLength) local hitObject, hitPos = game.Workspace:FindPartOnRay(Ray.new(startPos + (vec * .01), vec * rayLength), Handle) if hitObject and hitPos then local distance = rayLength - (hitPos - startPos).magnitude if RayIgnoreCheck(hitObject, hitPos) and distance > 0 then -- there is a chance here for potential infinite recursion return RayCast(hitPos, vec, distance) end end return hitObject, hitPos end function TagHumanoid(humanoid, player) -- Add more tags here to customize what tags are available. while humanoid:FindFirstChild('creator') do humanoid:FindFirstChild('creator'):Destroy() end local creatorTag = Instance.new("ObjectValue") creatorTag.Value = player creatorTag.Name = "creator" creatorTag.Parent = humanoid DebrisService:AddItem(creatorTag, 1.5) local weaponIconTag = Instance.new("StringValue") weaponIconTag.Value = IconURL weaponIconTag.Name = "icon" weaponIconTag.Parent = creatorTag end local function CreateFlash() if FlashHolder then local flash = Instance.new('Fire', FlashHolder) flash.Color = Color3.new(1, 140 / 255, 0) flash.SecondaryColor = Color3.new(1, 0, 0) flash.Size = 0.3 DebrisService:AddItem(flash, FireRate / 1.5) else FlashHolder = Instance.new("Part", Tool) FlashHolder.Transparency = 1 FlashHolder.CanCollide= false FlashHolder.Size = Vector3.new(1, 1, 1) FlashHolder.Position = Tool.Handle.Position local Weld = Instance.new("ManualWeld") Weld.C0 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) Weld.C1 = CFrame.new(0, 2.2, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0) Weld.Part0 = FlashHolder Weld.Part1 = Tool.Handle Weld.Parent = FlashHolder end end local function CreateBullet(bulletPos) local bullet = Instance.new('Part', Workspace) bullet.FormFactor = Enum.FormFactor.Custom bullet.Size = Vector3.new(0.1, 0.1, 0.1) bullet.BrickColor = MyPlayer.TeamColor bullet.Shape = Enum.PartType.Ball bullet.CanCollide = false bullet.CFrame = CFrame.new(bulletPos) bullet.Anchored = true bullet.TopSurface = Enum.SurfaceType.Smooth bullet.BottomSurface = Enum.SurfaceType.Smooth bullet.Name = 'Bullet' DebrisService:AddItem(bullet, 2.5) local fire = Instance.new("Fire", bullet) fire.Color = Color3.new(MyPlayer.TeamColor.r, MyPlayer.TeamColor.g, MyPlayer.TeamColor.b) fire.SecondaryColor = Color3.new(MyPlayer.TeamColor.r, MyPlayer.TeamColor.g, MyPlayer.TeamColor.b) fire.Size = 5 fire.Heat = 0 DebrisService:AddItem(fire, 0.2) return bullet end local function Reload() if not Reloading then Reloading = true -- Don't reload if you are already full or have no extra ammo if AmmoInClip ~= ClipSize and SpareAmmo > 0 then if RecoilTrack then RecoilTrack:Stop() end if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then if WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then WeaponGui.Crosshair.ReloadingLabel.Visible = true end end wait(ReloadTime) -- Only use as much ammo as you have local ammoToUse = math.min(ClipSize - AmmoInClip, SpareAmmo) AmmoInClip = AmmoInClip + ammoToUse SpareAmmo = SpareAmmo - ammoToUse UpdateAmmo(AmmoInClip) end Reloading = false end end function OnFire() if IsShooting then return end if MyHumanoid and MyHumanoid.Health > 0 then if RecoilTrack and AmmoInClip > 0 then RecoilTrack:Play() end IsShooting = true while LeftButtonDown and AmmoInClip > 0 and not Reloading do if Spread and not DecreasedAimLastShot then Spread = math.min(MaxSpread, Spread + AimInaccuracyStepAmount) UpdateCrosshair(Spread) end DecreasedAimLastShot = not DecreasedAimLastShot if Handle:FindFirstChild('FireSound') then Handle.FireSound:Play() end CreateFlash() if MyMouse then local targetPoint = MyMouse.Hit.p local shootDirection = (targetPoint - Handle.Position).unit -- Adjust the shoot direction randomly off by a little bit to account for recoil shootDirection = CFrame.Angles((0.5 - math.random()) * 2 * Spread, (0.5 - math.random()) * 2 * Spread, (0.5 - math.random()) * 2 * Spread) * shootDirection local hitObject, bulletPos = RayCast(Handle.Position, shootDirection, Range) local bullet -- Create a bullet here if hitObject then bullet = CreateBullet(bulletPos) end if hitObject and hitObject.Parent then local hitHumanoid = hitObject.Parent:FindFirstChild("Humanoid") if hitHumanoid then local hitPlayer = game.Players:GetPlayerFromCharacter(hitHumanoid.Parent) if MyPlayer.Neutral or (hitPlayer and hitPlayer.TeamColor ~= MyPlayer.TeamColor) then TagHumanoid(hitHumanoid, MyPlayer) hitHumanoid:TakeDamage(Damage) if bullet then bullet:Destroy() bullet = nil --bullet.Transparency = 1 end Spawn(UpdateTargetHit) end end end AmmoInClip = AmmoInClip - 1 UpdateAmmo(AmmoInClip) end wait(FireRate) end IsShooting = false if AmmoInClip == 0 then Reload() end if RecoilTrack then RecoilTrack:Stop() end end end local TargetHits = 0 function UpdateTargetHit() TargetHits = TargetHits + 1 if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then WeaponGui.Crosshair.TargetHitImage.Visible = true end wait(0.5) TargetHits = TargetHits - 1 if TargetHits == 0 and WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then WeaponGui.Crosshair.TargetHitImage.Visible = false end end function UpdateCrosshair(value, mouse) if WeaponGui then local absoluteY = 650 WeaponGui.Crosshair:TweenSize( UDim2.new(0, value * absoluteY * 2 + 23, 0, value * absoluteY * 2 + 23), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, 0.33) end end function UpdateAmmo(value) if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('ClipAmmo') then WeaponGui.AmmoHud.ClipAmmo.Text = AmmoInClip if value > 0 and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then WeaponGui.Crosshair.ReloadingLabel.Visible = false end end if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('TotalAmmo') then WeaponGui.AmmoHud.TotalAmmo.Text = SpareAmmo end end function OnMouseDown() LeftButtonDown = true OnFire() end function OnMouseUp() LeftButtonDown = false end function OnKeyDown(key) if string.lower(key) == 'r' then Reload() end end function OnEquipped(mouse) RecoilAnim = WaitForChild(Tool, 'Recoil') FireSound = WaitForChild(Handle, 'FireSound') MyCharacter = Tool.Parent MyPlayer = game:GetService('Players'):GetPlayerFromCharacter(MyCharacter) MyHumanoid = MyCharacter:FindFirstChild('Humanoid') MyTorso = MyCharacter:FindFirstChild('Torso') MyMouse = mouse WeaponGui = WaitForChild(Tool, 'WeaponHud'):Clone() if WeaponGui and MyPlayer then WeaponGui.Parent = MyPlayer.PlayerGui UpdateAmmo(AmmoInClip) end if RecoilAnim then RecoilTrack = MyHumanoid:LoadAnimation(RecoilAnim) end if MyMouse then -- Disable mouse icon MyMouse.Icon = "rbxasset://textures\\GunCursor.png" MyMouse.Button1Down:connect(OnMouseDown) MyMouse.Button1Up:connect(OnMouseUp) MyMouse.KeyDown:connect(OnKeyDown) end end
--------------------[ STANCE FUNCTIONS ]----------------------------------------------
function Stand(OnDeselected) local LHip = Torso["Left Hip"] local RHip = Torso["Right Hip"] local Root = HRP.RootJoint Stance = 0 if S.StanceAnimation and (not OnDeselected) then spawn(function() local PreviousOffset = Humanoid.CameraOffset local PreviousRootP = Root.C0.p for X = 0, 90, 1.5 / S.StanceChangeSpeed do if Stance ~= 0 then break end local Alpha = Sine(X) Humanoid.CameraOffset = PreviousOffset:lerp(StanceOffset[1], Alpha) Root.C0 = CF(PreviousRootP:lerp(VEC3(), Alpha)) * CFANG(RAD(-90), 0, RAD(180)) RS:wait() end end) TweenJoint(ABWeld, CF(), CF(), Sine, S.StanceChangeSpeed) TweenJoint(LHip, CF(-1, -1, 0) * CFANG(0, RAD(-90), 0), CF(-0.5, 1, 0) * CFANG(0, RAD(-90), 0), Sine, S.StanceChangeSpeed) TweenJoint(RHip, CF(1, -1, 0) * CFANG(RAD(-180), RAD(90), 0), CF(0.5, 1, 0) * CFANG(RAD(-180), RAD(90), 0), Sine, S.StanceChangeSpeed) elseif OnDeselected then Humanoid.CameraOffset = StanceOffset[1] ABWeld.C0 = CF() ABWeld.C1 = CF() LHip.C0 = CF(-1, -1, 0) * CFANG(0, RAD(-90), 0) LHip.C1 = CF(-0.5, 1, 0) * CFANG(0, RAD(-90), 0) RHip.C0 = CF(1, -1, 0) * CFANG(RAD(-180), RAD(90), 0) RHip.C1 = CF(0.5, 1, 0) * CFANG(RAD(-180), RAD(90), 0) Root.C0 = CFANG(RAD(-90), 0, RAD(180)) end end function Crouch() local LHip = Torso["Left Hip"] local RHip = Torso["Right Hip"] local Root = HRP.RootJoint Stance = 1 if S.StanceAnimation then spawn(function() local PreviousOffset = Humanoid.CameraOffset local PreviousRootP = Root.C0.p for X = 0, 90, 1.5 / S.StanceChangeSpeed do if Stance ~= 1 then break end local Alpha = Sine(X) Humanoid.CameraOffset = PreviousOffset:lerp(StanceOffset[2], Alpha) Root.C0 = CF(PreviousRootP:lerp(VEC3(0, -1, 0), Alpha)) * CFANG(RAD(-100), 0, RAD(190)) RS:wait() end end) TweenJoint(ABWeld, CF(0, 0, -1 / 50), CF(), Sine, S.StanceChangeSpeed) TweenJoint(LHip, CF(-1, -0.5, 0) * CFANG(0, RAD(-60), 0), CF(-0.5, 0.5, 1) * CFANG(0, RAD(-90), RAD(-90)), Sine, S.StanceChangeSpeed) TweenJoint(RHip, CF(1, -0.7, 0) * CFANG(RAD(-160), RAD(90), 0), CF(0.5, 0.5, 1) * CFANG(RAD(-180), RAD(90), 0), Sine, S.StanceChangeSpeed) else Humanoid.CameraOffset = StanceOffset[2] ABWeld.C0 = CF(0, 0, -1 / 16) ABWeld.C1 = CF() LHip.C0 = CF(-1, -0.5, 0) * CFANG(0, RAD(-90), 0) LHip.C1 = CF(-0.5, 0.5, 1) * CFANG(0, RAD(-90), RAD(-90)) RHip.C0 = CF(1, -0.5, 0.25) * CFANG(RAD(-180), RAD(90), 0) RHip.C1 = CF(0.5, 0.5, 1) * CFANG(RAD(-180), RAD(90), 0) Root.C0 = CF(0, -1, 0) * CFANG(RAD(-90), 0, RAD(180)) end end function Prone() local LHip = Torso["Left Hip"] local RHip = Torso["Right Hip"] local Root = HRP.RootJoint Stance = 2 if S.StanceAnimation then spawn(function() local PreviousOffset = Humanoid.CameraOffset local PreviousRootP = Root.C0.p for X = 0, 90, 1.5 / S.StanceChangeSpeed do if Stance ~= 2 then break end local Alpha = Sine(X) Humanoid.CameraOffset = PreviousOffset:lerp(StanceOffset[3], Alpha) Root.C0 = CF(PreviousRootP:lerp(VEC3(0, -2.5, 1), Alpha)) * CFANG(RAD(180), 0, RAD(180)) RS:wait() end end) TweenJoint(ABWeld, CF(0, 0, -1 / 8), CF(), Sine, S.StanceChangeSpeed) TweenJoint(LHip, CF(-1, -1, 0) * CFANG(0, RAD(-90), 0), CF(-0.5, 1, 0) * CFANG(0, RAD(-90), 0), Sine, S.StanceChangeSpeed) TweenJoint(RHip, CF(1, -1, 0) * CFANG(RAD(-180), RAD(90), 0), CF(0.5, 1, 0) * CFANG(RAD(-180), RAD(90), 0), Sine, S.StanceChangeSpeed) else Humanoid.CameraOffset = StanceOffset[3] ABWeld.C0 = CF(0, 0, -1 / 8) ABWeld.C1 = CF() LHip.C0 = CF(-1, -1, 0) * CFANG(0, RAD(-90), 0) LHip.C1 = CF(-0.5, 1, 0) * CFANG(0, RAD(-90), 0) RHip.C0 = CF(1, -1, 0) * CFANG(RAD(-180), RAD(90), 0) RHip.C1 = CF(0.5, 1, 0) * CFANG(RAD(-180), RAD(90), 0) Root.C0 = CF(0, -2.5, 1) * CFANG(RAD(180), 0, RAD(180)) end end function Dive(Speed) local DiveVelocity = (HRP.CFrame * CFANG(RAD(18),0,0)).lookVector * Speed * (35 / 16) * 4e3 HRP.Velocity = VEC3() Torso.Velocity = VEC3() local BF = Instance.new("BodyForce") BF.force = DiveVelocity BF.Parent = HRP delay(0.05, function() Prone() local Start = tick() while true do wait() if (tick() - Start) > 0.1 then break end BF.force = -HRP.Velocity * 700 end BF:Destroy() end) end
--[[ Turns brake lights on or off depending on the status ]]
function VehicleLightsComponent:updateStatus(statusesChanged) if statusesChanged.Braking ~= nil then local brakeLightsOn = statusesChanged.Braking if brakeLightsOn ~= self.state.brakeLights then self.state.brakeLights = brakeLightsOn self:toggleLights(self.brakeLights, brakeLightsOn) end end end return VehicleLightsComponent
-----------------------------------------------------------------------------------------------------------------
local ObjectShakeAddedEvent = Instance.new("BindableEvent") local ObjectShakeRemovedEvent = Instance.new("BindableEvent") local ObjectShakeUpdatedEvent = Instance.new("BindableEvent") local PausedEvent = Instance.new("BindableEvent") local ResumedEvent = Instance.new("BindableEvent") local WindShake = { ObjectMetadata = {}; Octree = Octree.new(); Handled = 0; Active = 0; LastUpdate = os.clock(); ObjectShakeAdded = ObjectShakeAddedEvent.Event; ObjectShakeRemoved = ObjectShakeRemovedEvent.Event; ObjectShakeUpdated = ObjectShakeUpdatedEvent.Event; Paused = PausedEvent.Event; Resumed = ResumedEvent.Event; } export type WindShakeSettings = { WindDirection: Vector3?, WindSpeed: number?, WindPower: number?, } function WindShake:Connect(funcName: string, event: RBXScriptSignal): RBXScriptConnection local callback = self[funcName] assert(typeof(callback) == "function", "Unknown function: " .. funcName) return event:Connect(function (...) return callback(self, ...) end) end function WindShake:AddObjectShake(object: BasePart, settingsTable: WindShakeSettings?) if typeof(object) ~= "Instance" then return end if not object:IsA("BasePart") then return end local metadata = self.ObjectMetadata if metadata[object] then return else self.Handled += 1 end metadata[object] = { Node = self.Octree:CreateNode(object.Position, object); Settings = Settings.new(object, DEFAULT_SETTINGS); Seed = math.random(1000) * 0.1; Origin = object.CFrame; } self:UpdateObjectSettings(object, settingsTable) ObjectShakeAddedEvent:Fire(object) end function WindShake:RemoveObjectShake(object: BasePart) if typeof(object) ~= "Instance" then return end local metadata = self.ObjectMetadata local objMeta = metadata[object] if objMeta then self.Handled -= 1 metadata[object] = nil objMeta.Settings:Destroy() objMeta.Node:Destroy() if object:IsA("BasePart") then object.CFrame = objMeta.Origin end end ObjectShakeRemovedEvent:Fire(object) end function WindShake:Update() local now = os.clock() local dt = now - self.LastUpdate if dt < UPDATE_HZ then return end self.LastUpdate = now debug.profilebegin("WindShake") local camera = workspace.CurrentCamera local cameraCF = camera and camera.CFrame debug.profilebegin("Octree Search") local updateObjects = self.Octree:RadiusSearch(cameraCF.Position + (cameraCF.LookVector * 115), 120) debug.profileend() local activeCount = #updateObjects self.Active = activeCount if activeCount < 1 then return end local step = math.min(1, dt * 8) local cfTable = table.create(activeCount) local objectMetadata = self.ObjectMetadata debug.profilebegin("Calc") for i, object in ipairs(updateObjects) do local objMeta = objectMetadata[object] local lastComp = objMeta.LastCompute or 0 local origin = objMeta.Origin local current = objMeta.CFrame or origin if (now - lastComp) > COMPUTE_HZ then local objSettings = objMeta.Settings local seed = objMeta.Seed local amp = objSettings.WindPower * 0.1 local freq = now * (objSettings.WindSpeed * 0.08) local rotX = math.noise(freq, 0, seed) * amp local rotY = math.noise(freq, 0, -seed) * amp local rotZ = math.noise(freq, 0, seed+seed) * amp local offset = object.PivotOffset local worldpivot = origin * offset objMeta.Target = (worldpivot * CFrame.Angles(rotX, rotY, rotZ) + objSettings.WindDirection * ((0.5 + math.noise(freq, seed, seed)) * amp)) * offset:Inverse() objMeta.LastCompute = now end current = current:Lerp(objMeta.Target, step) objMeta.CFrame = current cfTable[i] = current end debug.profileend() workspace:BulkMoveTo(updateObjects, cfTable, Enum.BulkMoveMode.FireCFrameChanged) debug.profileend() end function WindShake:Pause() if self.UpdateConnection then self.UpdateConnection:Disconnect() self.UpdateConnection = nil end self.Active = 0 self.Running = false PausedEvent:Fire() end function WindShake:Resume() if self.Running then return else self.Running = true end -- Connect updater self.UpdateConnection = self:Connect("Update", RunService.Heartbeat) ResumedEvent:Fire() end function WindShake:Init() if self.Initialized then return else self.Initialized = true end -- Define attributes if they're undefined. local power = script:GetAttribute("WindPower") local speed = script:GetAttribute("WindSpeed") local direction = script:GetAttribute("WindDirection") if typeof(power) ~= "number" then script:SetAttribute("WindPower", DEFAULT_SETTINGS.WindPower) end if typeof(speed) ~= "number" then script:SetAttribute("WindSpeed", DEFAULT_SETTINGS.WindSpeed) end if typeof(direction) ~= "Vector3" then script:SetAttribute("WindDirection", DEFAULT_SETTINGS.WindDirection) end -- Clear any old stuff. self:Cleanup() -- Wire up tag listeners. local windShakeAdded = CollectionService:GetInstanceAddedSignal(COLLECTION_TAG) self.AddedConnection = self:Connect("AddObjectShake", windShakeAdded) local windShakeRemoved = CollectionService:GetInstanceRemovedSignal(COLLECTION_TAG) self.RemovedConnection = self:Connect("RemoveObjectShake", windShakeRemoved) for _,object in pairs(CollectionService:GetTagged(COLLECTION_TAG)) do self:AddObjectShake(object) end -- Automatically start. self:Resume() end function WindShake:Cleanup() if not self.Initialized then return end self:Pause() if self.AddedConnection then self.AddedConnection:Disconnect() self.AddedConnection = nil end if self.RemovedConnection then self.RemovedConnection:Disconnect() self.RemovedConnection = nil end table.clear(self.ObjectMetadata) self.Octree:ClearNodes() self.Handled = 0 self.Active = 0 self.Initialized = false end function WindShake:UpdateObjectSettings(object: Instance, settingsTable: WindShakeSettings) if typeof(object) ~= "Instance" then return end if typeof(settingsTable) ~= "table" then return end if (not self.ObjectMetadata[object]) and (object ~= script) then return end for key, value in pairs(settingsTable) do object:SetAttribute(key, value) end ObjectShakeUpdatedEvent:Fire(object) end function WindShake:UpdateAllObjectSettings(settingsTable: WindShakeSettings) if typeof(settingsTable) ~= "table" then return end for obj, objMeta in pairs(self.ObjectMetadata) do for key, value in pairs(settingsTable) do obj:SetAttribute(key, value) end ObjectShakeUpdatedEvent:Fire(obj) end end function WindShake:SetDefaultSettings(settingsTable: WindShakeSettings) self:UpdateObjectSettings(script, settingsTable) end return WindShake
-- HUB.Default:TweenPosition(UDim2.new(0, 0, mode,3),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,.4,true)
end swap() mouse.KeyDown:connect(function (key) key = string.lower(key) if key == "k" then --Camera controls if cam == ("car") then Camera.CameraSubject = player.Character.Humanoid Camera.CameraType = ("Custom") cam = ("freeplr") Camera.FieldOfView = 70 elseif cam == ("freeplr") then Camera.CameraSubject = player.Character.Humanoid Camera.CameraType = ("Attach") cam = ("lockplr") elseif cam == ("lockplr") then Camera.CameraSubject = carSeat Camera.CameraType = ("Custom") cam = ("car") Camera.FieldOfView = 70 end
---------------------------------- ------------FUNCTIONS------------- ----------------------------------
function UnDigify(digit) if digit < 1 or digit > 61 then return "" elseif digit == 1 then return "1" elseif digit == 2 then return "!" elseif digit == 3 then return "2" elseif digit == 4 then return "@" elseif digit == 5 then return "3" elseif digit == 6 then return "4" elseif digit == 7 then return "$" elseif digit == 8 then return "5" elseif digit == 9 then return "%" elseif digit == 10 then return "6" elseif digit == 11 then return "^" elseif digit == 12 then return "7" elseif digit == 13 then return "8" elseif digit == 14 then return "*" elseif digit == 15 then return "9" elseif digit == 16 then return "(" elseif digit == 17 then return "0" elseif digit == 18 then return "q" elseif digit == 19 then return "Q" elseif digit == 20 then return "w" elseif digit == 21 then return "W" elseif digit == 22 then return "e" elseif digit == 23 then return "E" elseif digit == 24 then return "r" elseif digit == 25 then return "t" elseif digit == 26 then return "T" elseif digit == 27 then return "y" elseif digit == 28 then return "Y" elseif digit == 29 then return "u" elseif digit == 30 then return "i" elseif digit == 31 then return "I" elseif digit == 32 then return "o" elseif digit == 33 then return "O" elseif digit == 34 then return "p" elseif digit == 35 then return "P" elseif digit == 36 then return "a" elseif digit == 37 then return "s" elseif digit == 38 then return "S" elseif digit == 39 then return "d" elseif digit == 40 then return "D" elseif digit == 41 then return "f" elseif digit == 42 then return "g" elseif digit == 43 then return "G" elseif digit == 44 then return "h" elseif digit == 45 then return "H" elseif digit == 46 then return "j" elseif digit == 47 then return "J" elseif digit == 48 then return "k" elseif digit == 49 then return "l" elseif digit == 50 then return "L" elseif digit == 51 then return "z" elseif digit == 52 then return "Z" elseif digit == 53 then return "x" elseif digit == 54 then return "c" elseif digit == 55 then return "C" elseif digit == 56 then return "v" elseif digit == 57 then return "V" elseif digit == 58 then return "b" elseif digit == 59 then return "B" elseif digit == 60 then return "n" elseif digit == 61 then return "m" else return "?" end end function IsBlack(note) if note%12 == 2 or note%12 == 4 or note%12 == 7 or note%12 == 9 or note%12 == 11 then return true end end local TweenService = game:GetService("TweenService") function Tween(obj,Goal,Time,Wait,...) local TwInfo = TweenInfo.new(Time,...) local twn = TweenService:Create(obj, TwInfo, Goal) twn:Play() if Wait then twn.Completed:wait() end return end local originals = Piano.Case.Originals:GetChildren() function HighlightPianoKey(note1,transpose) if not Settings.KeyAesthetics then return end local octave = math.ceil(note1/12) local note2 = (note1 - 1)%12 + 1 local yDist = 3 local TimeUp = .2 local TimeDn = .25 local key = Keys[octave][note2] local parts = key:GetChildren() for i,v in pairs(parts) do if i >= #parts then local obj = v local Properties = {} Properties.Position = Vector3.new(v.Position.x,originals[octave][note2][v.Name].Position.y + yDist,v.Position.z) Tween(obj,Properties,TimeUp,true,Enum.EasingStyle.Linear) else local obj = v local Properties = {} Properties.Position = Vector3.new(v.Position.x,originals[octave][note2][v.Name].Position.y + yDist,v.Position.z) Tween(obj,Properties,TimeUp,false,Enum.EasingStyle.Linear) end end for i,v in pairs(parts) do if i >= #parts then local obj = v local Properties = {} Properties.Position = Vector3.new(v.Position.x,originals[octave][note2][v.Name].Position.y - yDist,v.Position.z) Tween(obj,Properties,TimeDn,true,Enum.EasingStyle.Linear) else local obj = v local Properties = {} Properties.Position = Vector3.new(v.Position.x,originals[octave][note2][v.Name].Position.y - yDist,v.Position.z) Tween(obj,Properties,TimeDn,false,Enum.EasingStyle.Linear) end end for i,v in pairs(parts) do v.CFrame = originals[octave][note2][v.Name].CFrame end return end
--[=[ Taps into the observable and executes the onFire/onError/onComplete commands. https://rxjs-dev.firebaseapp.com/api/operators/tap @param onFire function? @param onError function? @param onComplete function? @return (source: Observable<T>) -> Observable<T> ]=]
function Rx.tap(onFire, onError, onComplete) assert(type(onFire) == "function" or onFire == nil, "Bad onFire") assert(type(onError) == "function" or onError == nil, "Bad onError") assert(type(onComplete) == "function" or onComplete == nil, "Bad onComplete") return function(source) assert(Observable.isObservable(source), "Bad observable") return Observable.new(function(sub) return source:Subscribe( function(...) if onFire then onFire(...) end if sub:IsPending() then sub:Fire(...) end end, function(...) if onError then onError(...) end sub:Error(...) end, function(...) if onComplete then onComplete(...) end sub:Complete(...) end) end) end end
--[[** ensures value is an integer @param value The value to check against @returns True iff the condition is satisfied, false otherwise **--]]
function t.integer(value) local success = t.number(value) if not success then return false end if value % 1 == 0 then return true else return false end end
-- Decompiled with the Synapse X Luau decompiler.
script.Parent.Visible = true; script.Parent.Parent.Background.Visible = true; wait(2); for v1 = 1, 10 do wait(); script.Parent.Text1.TextTransparency = script.Parent.Text1.TextTransparency - 0.1; end; wait(1); script.Parent.Names.Visible = true; wait(); script.Parent.Names.Frame:TweenPosition(UDim2.new(0, 0, -0.925, 0), "In", "Quint", 5); wait(7.5); script.Parent.Parent:Destroy();
--// # key, meme
mouse.KeyDown:connect(function(key) if key=="k" then if veh.Lightbar.middle.meme.IsPlaying == true then veh.Lightbar.middle.Wail:Stop() veh.Lightbar.middle.meme:Stop() veh.Lightbar.middle.Priority:Stop() script.Parent.Parent.Sirens.meme.BackgroundColor3 = Color3.fromRGB(62, 62, 62) else veh.Lightbar.middle.Wail:Stop() veh.Lightbar.middle.meme:Play() veh.Lightbar.middle.Priority:Stop() script.Parent.Parent.Sirens.meme.BackgroundColor3 = Color3.fromRGB(215, 135, 110) script.Parent.Parent.Sirens.Wail.BackgroundColor3 = Color3.fromRGB(62, 62, 62) script.Parent.Parent.Sirens.Priority.BackgroundColor3 = Color3.fromRGB(62, 62, 62) end end end)
---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
runService.RenderStepped:connect(function() if running then updatechar() CamPos = CamPos + (TargetCamPos - CamPos) *0.28 AngleX = AngleX + (TargetAngleX - AngleX) *0.35 local dist = TargetAngleY - AngleY dist = math.abs(dist) > 180 and dist - (dist / math.abs(dist)) * 360 or dist AngleY = (AngleY + dist *0.35) %360 cam.CameraType = Enum.CameraType.Scriptable cam.CoordinateFrame = CFrame.new(head.Position) * CFrame.Angles(0,math.rad(AngleY),0) * CFrame.Angles(math.rad(AngleX),0,0) * CFrame.new(0,0.8,0) -- offset humanoidpart.CFrame=CFrame.new(humanoidpart.Position)*CFrame.Angles(0,math.rad(AngleY),0) character.Humanoid.AutoRotate = false else game:GetService("UserInputService").MouseBehavior = Enum.MouseBehavior.Default; character.Humanoid.AutoRotate = true end if (cam.Focus.p-cam.CoordinateFrame.p).magnitude < 1 then running = false else running = true if freemouse == true then game:GetService("UserInputService").MouseBehavior = Enum.MouseBehavior.Default else game:GetService("UserInputService").MouseBehavior = Enum.MouseBehavior.LockCenter end end if not CanToggleMouse.allowed then freemouse = false end cam.FieldOfView = FieldOfView end)
--!strict -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER
return 9007199254740991
--throttle.Value = TCount
if carSeat.Throttle == 1 then if autoF - 1 > autoR or clutch.Clutch.Value ~= 1 then TCount = 1 else if TCount >= 1 then TCount = 1 else if speed > 50 then TCount = TCount + 0.167 elseif speed < 20 then TCount = TCount + 0.3334 else TCount = TCount + 0.02 end end end else if TCount <= 0 then TCount = 0 else TCount = 0 end end if currentgear.Value ~= 1 then tlR = 0 if clutch.Clutch.Value ~= 1 then if throttle.Value ~= 0 then if engine.Value > redline.Value * (1-clutch.Clutch.Value) then --------------?? WE DONT NEED A 'FOR' IN THE CLUTCH CODE engine.Value = engine.Value - 300 else engine.Value = engine.Value + (((600+decay.Value) * throttle.Value) - decay.Value) end else engine.Value = engine.Value - decay.Value end rpm.Value = engine.Value else engine.Value = rpm.Value end else tlR = tlR + 0.05 if tlR > 20 then script.Parent.Functions.Engine.Value = false first = 0.333 end engine.Value = engine.Value + (((600+decay.Value) * first) - decay.Value) if engine.Value > idle.Value*2 then first = 0 end --engine.Value = (idle.Value-decay.Value) end drive = "x"
--[[Susupension]]
Tune.SusEnabled = true -- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled --Front Suspension Tune.FSusDamping = 500 -- Spring Dampening Tune.FSusStiffness = 7500 -- Spring Force Tune.FSusLength = 2 -- Suspension length (in studs) Tune.FSusMaxExt = .3 -- Max Extension Travel (in studs) Tune.FSusMaxComp = .1 -- Max Compression Travel (in studs) Tune.FSusAngle = 80 -- Suspension Angle (degrees from horizontal) Tune.FWsBoneLen = 5 -- Wishbone Length Tune.FWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal) Tune.FAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel) --[[Lateral]] -.4 , -- positive = outward --[[Vertical]] -.5 , -- positive = upward --[[Forward]] 0 } -- positive = forward --Rear Suspension Tune.RSusDamping = 500 -- Spring Dampening Tune.RSusStiffness = 7500 -- Spring Force Tune.RSusLength = 2 -- Suspension length (in studs) Tune.RSusMaxExt = .3 -- Max Extension Travel (in studs) Tune.RSusMaxComp = .1 -- Max Compression Travel (in studs) Tune.RSusAngle = 80 -- Suspension Angle (degrees from horizontal) Tune.RWsBoneLen = 5 -- Wishbone Length Tune.RWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal) Tune.RAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel) --[[Lateral]] -.4 , -- positive = outward --[[Vertical]] -.5 , -- positive = upward --[[Forward]] 0 } -- positive = forward --Aesthetics Tune.SusVisible = true -- Spring Visible Tune.WsBVisible = false -- Wishbone Visible Tune.SusRadius = .2 -- Suspension Coil Radius Tune.SusThickness = .1 -- Suspension Coil Thickness Tune.SusColor = "Really black" -- Suspension Color [BrickColor] Tune.SusCoilCount = 6 -- Suspension Coil Count Tune.WsColor = "Black" -- Wishbone Color [BrickColor] Tune.WsThickness = .1 -- Wishbone Rod Thickness
-- AUTOOPEN EGGS
AutoOpenEggsButton.MouseEnter:Connect(function() AutoOpenEggsButton.Text = "419 R$" AutoOpenEggsButton.TextColor3 = Color3.fromRGB(0, 255, 0) end) AutoOpenEggsButton.MouseLeave:Connect(function() AutoOpenEggsButton.Text = "BUY" AutoOpenEggsButton.TextColor3 = Color3.fromRGB(255, 255, 255) end)
--s.Pitch = 0.7
while s.Pitch<0.65 do s.Pitch=s.Pitch+0.009 s:Play() if s.Pitch>1 then s.Pitch=1 end wait(0.001) end while s.Pitch<0.97 do s.Pitch=s.Pitch+0.003 s:Play() if s.Pitch>0.97 then s.Pitch=0.97 end wait(0.001) end
------------------------------------------------------------------
function FixVars() --This function fixes any errors in the Customize folder Acceleration2 = (Acceleration.Value < 0 and 0 or Acceleration.Value > 1000 and 1000 or Acceleration.Value) MaxBank2 = (MaxBank.Value < -90 and -90 or MaxBank.Value > 90 and 90 or MaxBank.Value) MaxSpeed2 = (MaxSpeed.Value < 0 and 0 or MaxSpeed.Value < StallSpeed.Value and StallSpeed.Value or MaxSpeed.Value) StallSpeed2 = (StallSpeed.Value < 0 and 0 or StallSpeed.Value > MaxSpeed.Value and MaxSpeed.Value or StallSpeed.Value) TurnSpeed2 = (TurnSpeed.Value < 0 and 0 or TurnSpeed.Value) ThrottleInc2 = (ThrottleInc.Value < 0 and 0 or ThrottleInc.Value) MaxAltitude2 = (MaxAltitude.Value < MinAltitude.Value and MinAltitude.Value or MaxAltitude.Value) MinAltitude2 = (MinAltitude.Value > MaxAltitude.Value and MaxAltitude.Value or MinAltitude.Value) MissileTime2 = (ReloadTimes.Missiles.Value < 0 and 0 or ReloadTimes.Missiles.Value) RocketTime2 = (ReloadTimes.Rockets.Value < 0 and 0 or ReloadTimes.Rockets.Value) GunTime2 = (ReloadTimes.Guns.Value < 0 and 0 or ReloadTimes.Guns.Value) FlareTime2 = (ReloadTimes.Flares.Value < 0 and 0 or ReloadTimes.Flares.Value) BombTime2 = (ReloadTimes.Bombs.Value < 0 and 0 or ReloadTimes.Bombs.Value) CameraType2 = (pcall(function() Camera.CameraType = CameraType.Value end) and CameraType.Value or "Custom") PlaneName2 = (PlaneName.Value == "" and "Plane" or PlaneName.Value) if WeaponsValue.Value then if WeaponsValue.Missiles.Value or WeaponsValue.Bombs.Value then Targetable2 = true elseif (not (WeaponsValue.Missiles.Value and WeaponsValue.Bombs.Value)) then Targetable2 = false end elseif (not WeaponsValue.Value) then Targetable2 = false end if FlightControls.SpeedUp.Value == "ArrowKeyUp" then SpeedUp2 = 17 SUAK = true elseif FlightControls.SpeedUp.Value == "ArrowKeyDown" then SpeedUp2 = 18 SUAK = true else SpeedUp2 = FlightControls.SpeedUp.Value SUAK = false end if FlightControls.SlowDown.Value == "ArrowKeyUp" then SlowDown2 = 17 SDAK = true elseif FlightControls.SlowDown.Value == "ArrowKeyDown" then SlowDown2 = 18 SDAK = true else SlowDown2 = FlightControls.SlowDown.Value SDAK = false end Engine.Direction.P = TurnSpeed2 end function FireMachineGun(GunParent) --This function creates the bullets for the MachineGuns while FiringGun do for _,v in pairs(GunParent:GetChildren()) do --This is what allow you to put as many MachineGuns as you want in the Guns folder if v:IsA("BasePart") then if v.Name == "MachineGun" then local Part = Instance.new("Part") Part.BrickColor = BrickColor.new("Really red") Part.Name = "Bullet" Part.CanCollide = false Part.FormFactor = "Symmetric" Part.Size = Vector3.new(5,5,3) Part.BottomSurface = "Smooth" Part.TopSurface = "Smooth" local Mesh = Instance.new("BlockMesh") Mesh.Parent = Part Mesh.Scale = Vector3.new(1/25,1/25,1) local BV = Instance.new("BodyVelocity") BV.Parent = Part BV.maxForce = Vector3.new(math.huge,math.huge,math.huge) local PlaneTag = Instance.new("ObjectValue") PlaneTag.Parent = Part PlaneTag.Name = "PlaneTag" PlaneTag.Value = Plane Part.Touched:connect(function(Object) --This lets me call the "Touched" function, which means I don't need an external script if (not Object:IsDescendantOf(Character)) then local HitHumanoid = Object.Parent:findFirstChild("Humanoid") if HitHumanoid then HitHumanoid:TakeDamage(100) --This only damges the player if they don't have a forcefield local CreatorTag = Instance.new("ObjectValue") CreatorTag.Name = "creator" CreatorTag.Value = Player CreatorTag.Parent = HitHumanoid elseif (not HitHumanoid) then Object:BreakJoints() end end end) Part.Parent = game.Workspace Part.CFrame = v.CFrame + v.CFrame.lookVector * 10 BV.velocity = (v.Velocity) + (Part.CFrame.lookVector * 2000) + (Vector3.new(0,0.15,0)) delay(3,function() Part:Destroy() end) end end end wait(GunTime2) end end function FireRockets(GunParent) --This function creates the rockets for the rocket spawns for _,v in pairs(GunParent:GetChildren()) do --This allows you to put as many RocketSpawns as you want in the Rockets folder if v:IsA("BasePart") then if v.Name == "RocketSpawn" then local Exploded = false local Part1 = Instance.new("Part") Part1.BrickColor = BrickColor.new("White") Part1.Name = "Missile" Part1.CanCollide = false Part1.FormFactor = "Symmetric" Part1.Size = Vector3.new(1,1,5) Part1.BottomSurface = "Smooth" Part1.TopSurface = "Smooth" local Mesh = Instance.new("SpecialMesh") Mesh.Parent = Part1 Mesh.MeshId = "http://www.roblox.com/asset/?id=2251534" Mesh.MeshType = "FileMesh" Mesh.Scale = Vector3.new(0.5,0.5,0.5) local Part2 = Instance.new("Part") Part2.Parent = Part1 Part2.Transparency = 1 Part2.Name = "Visual" Part2.CanCollide = false Part2.FormFactor = "Symmetric" Part2.Size = Vector3.new(1,1,1) Part2.BottomSurface = "Smooth" Part2.TopSurface = "Smooth" local Weld = Instance.new("Weld") Weld.Parent = Part1 Weld.Part0 = Part1 Weld.Part1 = Part2 Weld.C0 = CFrame.new(0,0,4) * CFrame.Angles(math.rad(90),0,0) local BV = Instance.new("BodyVelocity") BV.Parent = Part1 BV.maxForce = Vector3.new(math.huge,math.huge,math.huge) local BG = Instance.new("BodyGyro") BG.Parent = Part BG.maxTorque = Vector3.new(math.huge,math.huge,math.huge) BG.cframe = v.CFrame local Fire = Instance.new("Fire") Fire.Parent = Part2 Fire.Heat = 25 Fire.Size = 10 local Smoke = Instance.new("Smoke") Smoke.Parent = Part2 Smoke.Color = Color3.new(200/255,200/255,200/255) Smoke.Opacity = 0.7 Smoke.RiseVelocity = 25 Smoke.Size = 10 local PlaneTag = Instance.new("ObjectValue") PlaneTag.Parent = Part PlaneTag.Name = "PlaneTag" PlaneTag.Value = Plane Part1.Touched:connect(function(Object) if (not Exploded) then if (not Object:IsDescendantOf(Character)) then if Object.Name ~= "Missile" then Exploded = true local Explosion = Instance.new("Explosion",game.Workspace) Explosion.Position = Part1.Position Explosion.BlastPressure = 5000 Explosion.BlastRadius = 10 ScanPlayers(Part1.Position,10) Explosion.Parent = game.Workspace Part1:Destroy() end end end end) Part1.Parent = game.Workspace Part1.CFrame = v.CFrame + v.CFrame.lookVector * 10 BV.velocity = Part1.CFrame.lookVector * 1250 + Vector3.new(0,0.15,0) delay(5,function() Part1:Destroy() end) end end end end function DeployFlares(GunParent) --This function creates the flares for the flare spawns for _,v in pairs(GunParent:GetChildren()) do if v:IsA("BasePart") then if v.Name == "FlareSpawn" then local RandomFactor = 40 local RandomX = math.rad(math.random(-RandomFactor,RandomFactor)) local RandomY = math.rad(math.random(-RandomFactor,RandomFactor)) local Part = Instance.new("Part") Part.Transparency = 1 Part.Name = "Flare" Part.CanCollide = false Part.FormFactor = "Symmetric" Part.Size = Vector3.new(1,1,1) Part.BottomSurface = "Smooth" Part.TopSurface = "Smooth" local BG = Instance.new("BillboardGui") BG.Parent = Part BG.Size = UDim2.new(10,0,10,0) local IL = Instance.new("ImageLabel") IL.Parent = BG IL.BackgroundTransparency = 1 IL.Image = "http://www.roblox.com/asset/?id=43708803" IL.Size = UDim2.new(1,0,1,0) local Smoke = Instance.new("Smoke") Smoke.Parent = Part Smoke.Opacity = 0.5 Smoke.RiseVelocity = 25 Smoke.Size = 5 local PL = Instance.new("PointLight") PL.Parent = Part PL.Brightness = 10 PL.Color = Color3.new(1,1,0) PL.Range = 20 Part.Parent = game.Workspace Part.CFrame = (v.CFrame + v.CFrame.lookVector * 5) * CFrame.Angles(RandomX,RandomY,0) Part.Velocity = Part.CFrame.lookVector * 150 delay(5,function() Part:Destroy() end) end end end end function DropBomb(GunParent) --This function creates the non-guided bombs for the bomb spawns if (not Locked) then for _,v in pairs(GunParent:GetChildren()) do if v:IsA("BasePart") then if v.Name == "BombSpawn" then local Exploded = false local Part = Instance.new("Part") Part.Name = "Bomb" Part.CanCollide = false Part.FormFactor = "Symmetric" Part.Size = Vector3.new(2,2,9) Part.BottomSurface = "Smooth" Part.TopSurface = "Smooth" local Mesh = Instance.new("SpecialMesh") Mesh.Parent = Part Mesh.MeshId = "http://www.roblox.com/asset/?id=88782666" Mesh.MeshType = "FileMesh" Mesh.Scale = Vector3.new(4,4,4) Mesh.TextureId = "http://www.roblox.com/asset/?id=88782631" local BG = Instance.new("BodyGyro") BG.Parent = Part BG.maxTorque = Vector3.new(math.huge,math.huge,math.huge) BG.cframe = v.CFrame * CFrame.Angles(math.rad(90),0,0) local PlaneTag = Instance.new("ObjectValue") PlaneTag.Parent = Part PlaneTag.Name = "PlaneTag" PlaneTag.Value = Plane Part.Touched:connect(function(Object) if (not Exploded) then if (not Object:IsDescendantOf(Character)) and Object.Name ~= "Bomb" then Exploded = true local Explosion = Instance.new("Explosion") Explosion.Position = Part.Position Explosion.BlastPressure = 500000 Explosion.BlastRadius = 75 ScanPlayers(Part.Position,75) Explosion.Parent = game.Workspace Part:Destroy() end end end) Part.Parent = game.Workspace Part.CFrame = (v.CFrame * CFrame.Angles(math.rad(90),0,0)) + v.CFrame.lookVector * 3 Part.Velocity = (Part.CFrame.lookVector * (TrueAirSpeed * 0.75)) delay(7,function() Part:Destroy() end) end end end end end function DropGuidedBomb(Gun) --This function creates guided bombs for the bombs spawns if Locked then local Exploded = false local Part = Instance.new("Part") Part.Name = "Bomb" Part.CanCollide = false Part.FormFactor = "Symmetric" Part.Size = Vector3.new(2,2,9) Part.BottomSurface = "Smooth" Part.TopSurface = "Smooth" local Mesh = Instance.new("SpecialMesh") Mesh.Parent = Part Mesh.MeshId = "http://www.roblox.com/asset/?id=88782666" Mesh.MeshType = "FileMesh" Mesh.Scale = Vector3.new(4,4,4) Mesh.TextureId = "http://www.roblox.com/asset/?id=88782631" local OV = Instance.new("ObjectValue") OV.Parent = Part OV.Name = "Tracker" OV.Value = TargetPlayer.Character.Torso local NV = Instance.new("NumberValue") NV.Parent = Part NV.Name = "PlaneSpd" NV.Value = TrueAirSpeed * 0.8 --This makes the bombs travel speed 4/5 of the plane's speed local BG = Instance.new("BodyGyro") BG.Parent = Part BG.maxTorque = Vector3.new(math.huge,math.huge,math.huge) BG.P = 2000 local BV = Instance.new("BodyVelocity") BV.Parent = Part BV.maxForce = Vector3.new(math.huge,6000,math.huge) BV.velocity = Vector3.new(0,0,0) local Script = BombM:clone() Script.Parent = Part local PlaneTag = Instance.new("ObjectValue") PlaneTag.Parent = Part PlaneTag.Name = "PlaneTag" PlaneTag.Value = Plane Part.Touched:connect(function(Object) if (not Exploded) then if (not Object:IsDescendantOf(Character)) and Object.Name ~= "Bomb" then Exploded = true local Explosion = Instance.new("Explosion") Explosion.Position = Part.Position Explosion.BlastPressure = 500000 Explosion.BlastRadius = 75 ScanPlayers(Part.Position,75) Explosion.Parent = game.Workspace Part:Destroy() end end end) Part.Parent = game.Workspace Part.CFrame = (Gun.CFrame * CFrame.Angles(math.rad(90),0,0)) + Gun.CFrame.lookVector * 10 Script.Disabled = false end end function FireMissile(Gun) --This function creates the non-guided missiles for the missile spawns if (not Locked) then local Exploded = false local Part1 = Instance.new("Part") Part1.Name = "Missile" Part1.CanCollide = false Part1.FormFactor = "Symmetric" Part1.Size = Vector3.new(1,1,13) Part1.BottomSurface = "Smooth" Part1.TopSurface = "Smooth" local Mesh = Instance.new("SpecialMesh") Mesh.Parent = Part1 Mesh.MeshId = "http://www.roblox.com/asset/?id=2251534" Mesh.MeshType = "FileMesh" Mesh.TextureId = "http://www.roblox.com/asset/?id=2564491" local Part2 = Instance.new("Part") Part2.Parent = Part1 Part2.Name = "Visual" Part2.Transparency = 1 Part2.CanCollide = false Part2.FormFactor = "Symmetric" Part2.Size = Vector3.new(1,1,1) Part2.BottomSurface = "Smooth" Part2.TopSurface = "Smooth" local Weld = Instance.new("Weld") Weld.Parent = Part1 Weld.Part0 = Part1 Weld.Part1 = Part2 Weld.C0 = CFrame.new(0,0,5)*CFrame.Angles(math.rad(90),0,0) local BV = Instance.new("BodyVelocity") BV.Parent = Part1 BV.maxForce = Vector3.new(math.huge,math.huge,math.huge) local BG = Instance.new("BodyGyro") BG.Parent = Part BG.maxTorque = Vector3.new(math.huge,math.huge,math.huge) BG.cframe = Gun.CFrame * CFrame.Angles(math.rad(90),0,0) local Fire = Instance.new("Fire") Fire.Parent = Part2 Fire.Enabled = false Fire.Heat = 25 Fire.Size = 30 local Smoke = Instance.new("Smoke") Smoke.Parent = Part2 Smoke.Color = Color3.new(40/51,40/51,40/51) Smoke.Enabled = false Smoke.Opacity = 1 Smoke.RiseVelocity = 25 Smoke.Size = 25 local PlaneTag = Instance.new("ObjectValue") PlaneTag.Parent = Part PlaneTag.Name = "PlaneTag" PlaneTag.Value = Plane Part1.Touched:connect(function(Object) if (not Exploded) then if (not Object:IsDescendantOf(Character)) and Object.Name ~= "Missile" then Exploded = true local Explosion = Instance.new("Explosion") Explosion.Position = Part1.Position Explosion.BlastPressure = 50000 Explosion.BlastRadius = 50 ScanPlayers(Part1.Position,50) Explosion.Parent = game.Workspace Part1:Destroy() end end end) Part1.Parent = game.Workspace Part1.CFrame = (Gun.CFrame * CFrame.Angles(math.rad(90),0,0)) + Gun.CFrame.lookVector * 15 BV.velocity = Part1.CFrame.lookVector * Engine.Velocity.magnitude delay(0.3,function() BV.velocity = (Part1.CFrame.lookVector * 1500) + Vector3.new(0,0.15,0) Fire.Enabled = true Smoke.Enabled = true end) delay(5,function() Part1:Destroy() end) end end function FireGuidedMissile(Gun) --This function creates the guided missiles for the missile spawns if Targetable2 then if Locked then local Exploded = false local Part1 = Instance.new("Part") Part1.Name = "Missile" Part1.CanCollide = false Part1.FormFactor = "Symmetric" Part1.Size = Vector3.new(1,1,13) Part1.BottomSurface = "Smooth" Part1.TopSurface = "Smooth" local Mesh = Instance.new("SpecialMesh") Mesh.Parent = Part1 Mesh.MeshId = "http://www.roblox.com/asset/?id=2251534" Mesh.MeshType = "FileMesh" Mesh.TextureId = "http://www.roblox.com/asset/?id=2564491" local Part2 = Instance.new("Part") Part2.Parent = Part1 Part2.Transparency = 1 Part2.Name = "Visual" Part2.CanCollide = false Part2.FormFactor = "Symmetric" Part2.Size = Vector3.new(1,1,1) Part2.BottomSurface = "Smooth" Part2.TopSurface = "Smooth" local Weld = Instance.new("Weld") Weld.Parent = Part1 Weld.Part0 = Part1 Weld.Part1 = Part2 Weld.C0 = CFrame.new(0,0,5)*CFrame.Angles(math.rad(90),0,0) local OV = Instance.new("ObjectValue") OV.Parent = Part1 OV.Name = "Tracker" OV.Value = TargetPlayer.Character.Torso local BV = Instance.new("BodyVelocity") BV.Parent = Part1 BV.maxForce = Vector3.new(math.huge,math.huge,math.huge) local Script = MissileM:clone() Script.Parent = Part1 local Fire = Instance.new("Fire") Fire.Parent = Part2 Fire.Enabled = false Fire.Heat = 25 Fire.Size = 30 local Smoke = Instance.new("Smoke") Smoke.Parent = Part2 Smoke.Color = Color3.new(40/51,40/51,40/51) Smoke.Enabled = false Smoke.Opacity = 1 Smoke.RiseVelocity = 25 Smoke.Size = 25 local PlaneTag = Instance.new("ObjectValue") PlaneTag.Parent = Part PlaneTag.Name = "PlaneTag" PlaneTag.Value = Plane Part1.Touched:connect(function(Object) if (not Exploded) then if (not Object:IsDescendantOf(Character)) and Object.Name ~= "Missile" then Exploded = true local Explosion = Instance.new("Explosion") Explosion.Position = Part1.Position Explosion.BlastPressure = 50000 Explosion.BlastRadius = 50 ScanPlayers(Part1.Position,50) Explosion.Parent = game.Workspace Part1:Destroy() end end end) Part1.Parent = game.Workspace Part1.CFrame = (Gun.CFrame * CFrame.Angles(math.rad(90),0,0)) + Gun.CFrame.lookVector * 15 delay(0.3,function() Script.Disabled = false Fire.Enabled = true Smoke.Enabled = true end) delay(10,function() Part1:Destroy() end) end end end function ScanPlayers(Pos,Radius) --This is a function that I created that efficiently puts a CreatorTag in the player coroutine.resume(coroutine.create(function() for i,v in pairs(game.Players:GetPlayers()) do --This gets all the players if v.Character and v.Character:findFirstChild("Torso") then local PTorso = v.Character.Torso if ((PTorso.Position - Pos).magnitude + 2) <= Radius then --If the distance between the explosion and the player is less than the radius... local HitHumanoid = v.Character:findFirstChild("Humanoid") if HitHumanoid then local CreatorTag = Instance.new("ObjectValue") CreatorTag.Name = "creator" CreatorTag.Value = Player CreatorTag.Parent = HitHumanoid game:GetService("Debris"):AddItem(CreatorTag,0.1) end end end end end)) end function ReloadRocket(Time) --This function reloads the rockets based on the rocket reload time if (not RocketEnabled) then wait(Time) RocketEnabled = true end end function ReloadFlare(Time) --This function reloads the flares based on the flare reload time if (not FlareEnabled) then wait(Time) FlareEnabled = true end end function ReloadBomb(Time) --This function reloads the bombs based on the bomb reload time if (not BombEnabled) then wait(Time) BombEnabled = true end end function ReloadMissile(Time) --This function reloads the missile based on the missile reload time if (not MissileEnabled) then wait(Time) MissileEnabled = true end end function onMouseMoved(mouse) --This function is activated when the mouse moves if Targetable2 then --If the plane can target... local Gui = GuiClone.Main if Targeting then mouse.Icon = AimingCursor --All the cursors in this script were made by me Gui.Mode.Text = "Targeting Mode" local FoundPlayer = false for i,v in pairs(game.Players:GetPlayers()) do if v.Character then if v.Character:findFirstChild("Torso") then if v ~= Player then if ((v.TeamColor ~= Player.TeamColor) or v.Neutral) then local myHead = Character.Head local TorsoPos = v.Character.Torso.CFrame local Distance = (myHead.CFrame.p - TorsoPos.p).magnitude local MouseDirection = (mouse.Hit.p - myHead.CFrame.p).unit local Offset = (((MouseDirection * Distance) + myHead.CFrame.p) - TorsoPos.p).magnitude if (not Locked) then if (Offset/Distance) < 0.1 then FoundPlayer = true if TargetPlayer ~= v then TargetPlayer = v mouse.Icon = TargetCursor AimGui.Enabled = true LockGui.Enabled = false AimGui.Adornee = TargetPlayer.Character.Torso LockGui.Adornee = nil end end if (not FoundPlayer) and TargetPlayer then TargetPlayer = nil mouse.Icon = AimingCursor AimGui.Enabled = false LockGui.Enabled = false AimGui.Adornee = nil LockGui.Adornee = nil end elseif Locked then mouse.Icon = LockedCursor AimGui.Enabled = false LockGui.Enabled = true AimGui.Adornee = nil LockGui.Adornee = TargetPlayer.Character.Torso end end end end end end elseif (not Targeting) then mouse.Icon = NormalCursor Gui.Mode.Text = "Flying Mode" end end end function onButton1Down(mouse) --This function is activated when you press the left mouse button Locked = ((not Locked) and TargetPlayer and Targeting and EngineOn and Targeting2) end function IncreaseSpd() --This function increases the speed if EngineOn then if Selected then while Accelerating do Throttle = (Throttle < 1 and Throttle + 0.01 or 1) DesiredSpeed = MaxSpeed2 * Throttle wait(ThrottleInc2) end end end end function DecreaseSpd() --This function decreases the speed if EngineOn then if Selected then while Decelerating do Throttle = (Throttle > 0 and Throttle - 0.01 or 0) DesiredSpeed = MaxSpeed2 * Throttle wait(ThrottleInc2) end end end end function RoundNumber(Num) --This function rounds a number to the nearest whole number return ((Num - math.floor(Num)) >= 0.5 and math.ceil(Num) or math.floor(Num)) end function GetGear(Parent) --This function gets all the parts in the Gear folder for i,v in pairs(Parent:GetChildren()) do if (v:IsA("BasePart")) then if (not v:findFirstChild("GearProp")) then local GearProp = Instance.new("StringValue") GearProp.Name = "GearProp" GearProp.Value = v.Transparency..","..tostring(v.CanCollide) GearProp.Parent = v end table.insert(LandingGear,v) --This inserts a table with the gear's properties into the LandingGear table end GetGear(v) end end function ChangeGear() --This function extends or retracts the gear for i,v in pairs(LandingGear) do local GearProp = v.GearProp local Comma = GearProp.Value:find(",",1,true) local TransVal = tonumber(GearProp.Value:sub(1,Comma - 1)) local CollideVal = GearProp.Value:sub(Comma + 1) v.Transparency = (TransVal ~= 1 and (GearUp and TransVal or 1)) v.CanCollide = (CollideVal and (GearUp and CollideVal or false)) end end function SetUpGui() --This function sets up the PlaneGui local Gui = GuiClone.Main Gui.Title.Text = PlaneName2 local TargetStats = Gui.Parent.Target local HUD = Gui.Parent.HUD local ControlsA,ControlsB = Gui.ControlsA,Gui.ControlsB local FrameA,FrameB = Gui.FrameA,Gui.FrameB local C1A,C1B = FrameA.C1.Key,FrameB.C1.Key local C2A,C2B = FrameA.C2.Key,FrameB.C2.Key local C3A,C3B = FrameA.C3.Key,FrameB.C3.Key local C4A,C4B = FrameA.C4.Key,FrameB.C4.Key local C5A,C5B = FrameA.C5.Key,FrameB.C5.Key local C6,C7 = FrameA.C6.Key,FrameA.C7.Key local GearText = Gui.Gear for i,v in pairs(LandingGear) do --This section determines whether the gear are up or down if v.Transparency == 1 then GearUp = true else GearUp = false break end end local MaxSpeedScaled = math.ceil(MaxSpeed2/50) for i = 1,(MaxSpeedScaled + 10) do --This creates a loop that clones the SpeedGui and positions it accordingly local SpeedGui = HUD.Speed.Main local Speed0 = SpeedGui["Speed-0"] local SpeedClone = Speed0:clone() SpeedClone.Position = UDim2.new(0,0,1,-(80 + (75 * i))) SpeedClone.Name = ("Speed-%i"):format(50 * i) SpeedClone.Text.Text = tostring(50 * i) SpeedClone.Parent = SpeedGui end local MaxAltScaled = math.ceil(MaxAltitude2/500) for i = 1,(MaxAltScaled + 10) do --This creates a loop that clones the AltitudeGui and positions it accordingly local AltGui = HUD.Altitude.Main local Altitude0 = AltGui["Altitude-0"] local AltClone = Altitude0:clone() AltClone.Position = UDim2.new(0,0,1,-(80 + (75 * i))) AltClone.Name = ("Altitude-%s"):format(tostring(0.5 * i)) AltClone.Text.Text = tostring(0.5 * i) AltClone.Parent = AltGui end GearText.Text = (GearUp and "Gear Up" or "Gear Down") C1A.Text = "Key: "..FlightControls.Engine.Value:upper() if FlightControls.SpeedUp.Value == "ArrowKeyUp" then C2A.Text = "Key: ArrowKeyUp" elseif FlightControls.SpeedUp.Value == "ArrowKeyDown" then C2A.Text = "Key: ArrowKeyDown" else C2A.Text = "Key: "..FlightControls.SpeedUp.Value:upper() end if FlightControls.SlowDown.Value == "ArrowKeyUp" then C3A.Text = "Key: ArrowKeyUp" elseif FlightControls.SlowDown.Value == "ArrowKeyDown" then C3A.Text = "Key: ArrowKeyDown" else C3A.Text = "Key: "..FlightControls.SlowDown.Value:upper() end C4A.Text = "Key: "..FlightControls.Gear.Value:upper() if Targetable2 then C5A.Text = "Key: "..TargetControls.Modes.Value:upper() else C5A.Parent.Visible = false end if Ejectable.Value then C6.Text = "Key: "..FlightControls.Eject.Value:upper() else C6.Parent.Visible = false end if CamLock.Value then C7.Text = "Key: "..FlightControls.LockCam.Value:upper() else C7.Parent.Visible = false end if (not WeaponsValue.Value) then C1B.Parent.Visible = false C2B.Parent.Visible = false C3B.Parent.Visible = false C4B.Parent.Visible = false C5B.Parent.Visible = false FrameB.Title.Text = "No Weapons" elseif WeaponsValue.Value then if WeaponsValue.Missiles.Value then C1B.Text = "Key: "..WeaponControls.FireMissile.Value:upper() elseif (not WeaponsValue.Missiles.Value) then C1B.Parent.Visible = false end if WeaponsValue.Rockets.Value then C2B.Text = "Key: "..WeaponControls.FireRockets.Value:upper() elseif (not WeaponsValue.Rockets.Value) then C2B.Parent.Visible = false end if WeaponsValue.Guns.Value then C3B.Text = "Key: "..WeaponControls.FireGuns.Value:upper() elseif (not WeaponsValue.Guns.Value) then C3B.Parent.Visible = false end if WeaponsValue.Bombs.Value then C4B.Text = "Key: "..WeaponControls.DropBombs.Value:upper() elseif (not WeaponsValue.Bombs.Value) then C4B.Parent.Visible = false end if WeaponsValue.Flares.Value then C5B.Text = "Key: "..WeaponControls.DeployFlares.Value:upper() elseif (not WeaponsValue.Flares.Value) then C5B.Parent.Visible = false end end ControlsA.MouseButton1Click:connect(function() --This function allows the Flight Controls frame to be opened or closed without an external script if GuiAVisible then GuiAVisible = false FrameA:TweenPosition(UDim2.new(0,150,0,-190),"In","Quad",1,true) elseif (not GuiAVisible) then GuiAVisible = true FrameA:TweenPosition(UDim2.new(0,150,0,170),"Out","Quad",1,true) end end) ControlsB.MouseButton1Click:connect(function() if GuiBVisible then GuiBVisible = false FrameB:TweenPosition(UDim2.new(0,-150,0,-150),"In","Quad",1,true) elseif (not GuiBVisible) then GuiBVisible = true FrameB:TweenPosition(UDim2.new(0,-150,0,170),"Out","Quad",1,true) end end) end function GetRoll(CF) --This function gets the rotation of the Engine. Credit to DevAdrian for this local CFRight = CF * CFrame.Angles(0,math.rad(90),0) local CFNoRollRight = CFrame.new(CF.p,CF.p + CF.lookVector) * CFrame.Angles(0,math.rad(90),0) local CFDiff = CFRight:toObjectSpace(CFNoRollRight) return (-math.atan2(CFDiff.lookVector.Y, CFDiff.lookVector.Z) % (math.pi * 2) + math.pi) end function GetPitch(CF) --This function gets the pitch of the Engine. Credit to DevAdrian for this local LV = CF.lookVector local XZDist = math.sqrt(LV.x^2 + LV.z^2) return math.atan(LV.y / XZDist) end function UpdateCamera() --This function uses the RunService to update the camera. It happens very fast so it is smooth if Selected then if (not LockedCam) then Camera.CameraType = CameraType2 elseif LockedCam then local HeadCF = Character.Head.CFrame local PlaneSize = Plane:GetModelSize().magnitude/3 local Origin = HeadCF.p + (HeadCF.lookVector * (PlaneSize - 1)) local Target = HeadCF.p + (HeadCF.lookVector * PlaneSize) Camera.CameraType = Enum.CameraType.Scriptable Camera.CoordinateFrame = CFrame.new(Origin,Target) Camera:SetRoll(GetRoll(Character.Head.CFrame)) end else Camera.CameraType = Enum.CameraType.Custom end end function UpdateTargetStats(Target,Gui) --This function updates the stats about the Target if Target then local myHead = Character.Head local TorsoPos = Target.Character.Torso.CFrame local Distance = (myHead.CFrame.p - TorsoPos.p).magnitude local TargetSpeed = (Target.Character.Torso.Velocity).magnitude local TargetAlt = Target.Character.Torso.Position.Y Gui.LockName.Text = ("Target: %s"):format(Target.Name) Gui.Dist.Text = ("Distance: %s"):format(tostring(math.floor(Distance * 10)/10)) Gui.Speed.Text = ("Speed: %s"):format(tostring(math.floor(TargetSpeed * 10)/10)) Gui.Altitude.Text = ("Altitude: %s"):format(tostring(math.floor(TargetAlt * 10)/10)) elseif (not Target) then Gui.LockName.Text = "Target: None" Gui.Dist.Text = "Distance: N/A" Gui.Speed.Text = "Speed: N/A" Gui.Altitude.Text = "Altitude: N/A" end end function UpdateHUD(Gui) --This function updates the HUD whenever the camera is locked Gui.Roll.Rotation = math.deg(GetRoll(Character.Head.CFrame)) local PitchNum = math.deg(GetPitch(Character.Head.CFrame))/90 Gui.Roll.Pitch.Position = UDim2.new(0,-200,0,-500 + (PitchNum * 450)) local SpeedScaled = TrueAirSpeed/50 Gui.Speed.Main.Position = UDim2.new(0,0,0.5,SpeedScaled * 75) Gui.Speed.Disp.Text.Text = RoundNumber(TrueAirSpeed) local AltScaled = RoundNumber(Engine.Position.Y)/500 Gui.Altitude.Main.Position = UDim2.new(0,0,0.5,AltScaled * 75) Gui.Altitude.Disp.Text.Text = RoundNumber(Engine.Position.Y) local NegFactor = (Engine.Velocity.y/math.abs(Engine.Velocity.y)) local VerticalSpeed = RoundNumber(math.abs(Engine.Velocity.y)) Gui.ClimbRate.Text = ("VSI: %i"):format(VerticalSpeed * NegFactor) Gui.GearStatus.Text = (GearUp and "Gear Up" or "Gear Down") Gui.GearStatus.TextColor3 = (GearUp and Color3.new(0,1,0) or Color3.new(1,0,0)) Gui.EngineStatus.Text = (EngineOn and "Engine On" or "Engine Off") Gui.EngineStatus.TextColor3 = (EngineOn and Color3.new(0,1,0) or Color3.new(1,0,0)) Gui.StallWarn.Visible = ((not Taxi()) and Stall()) Gui.PullUp.Visible = (EngineOn and (not Taxi()) and (AltRestrict.Value) and (Engine.Position.Y < (MinAltitude2 + 20))) Gui.TaxiStatus.Visible = (Engine and Taxi()) Gui.Throttle.Bar.Tray.Position = UDim2.new(0,0,1,-(Throttle * 460)) Gui.Throttle.Bar.Tray.Size = UDim2.new(1,0,0,(Throttle * 460)) Gui.Throttle.Disp.Text = math.abs(math.floor(Throttle * 100)).."%" local StallLinePos = (StallSpeed2/math.floor(TrueAirSpeed + 0.5)) * (StallSpeed2/MaxSpeed2) local StallLinePosFix = (StallLinePos > 1 and 1 or StallLinePos < 0 and 0 or StallLinePos) Gui.Throttle.Bar.StallLine.Position = UDim2.new(0,0,1 - StallLinePosFix,0) Gui.Throttle.Bar.Tray.BackgroundColor3 = (Throttle <= StallLinePosFix and Color3.new(1,0,0) or Color3.new(0,1,0)) end function UpdateGui(Taxiing,Stalling) --This function updates the gui. local Gui = GuiClone.Main local TargetStats = GuiClone.Target local HUD = Player.PlayerGui.PlaneGui.HUD Gui.Visible = ((not HUDOnLock.Value) or (HUDOnLock.Value and (not LockedCam))) HUD.Visible = (LockedCam and HUDOnLock.Value) if LockedCam and HUDOnLock.Value then UpdateHUD(HUD) end if Targetable2 then UpdateTargetStats(TargetPlayer,TargetStats) end Gui.PullUp.Visible = (EngineOn and (not Taxiing) and (AltRestrict.Value) and (Engine.Position.Y < (MinAltitude2 + 20))) Gui.Taxi.Visible = (EngineOn and Taxiing) Gui.Stall.Visible = ((not Taxiing) and Stalling) Gui.Altitude.Text = "Altitude: "..RoundNumber(Engine.Position.Y) Gui.Speed.Text = "Speed: "..RoundNumber(TrueAirSpeed) Gui.Throttle.Bar.Tray.Size = UDim2.new(Throttle,0,1,0) Gui.Throttle.Percent.Text = math.abs(math.floor(Throttle * 100)).."%" local StallLinePos = (StallSpeed2/math.floor(TrueAirSpeed + 0.5)) * (StallSpeed2/MaxSpeed2) local StallLinePosFix = (StallLinePos > 1 and 1 or StallLinePos < 0 and 0 or StallLinePos) Gui.Throttle.Bar.StallLine.Position = UDim2.new(StallLinePosFix,0,0,0) Gui.Throttle.Bar.Tray.BackgroundColor3 = (Throttle <= StallLinePosFix and Color3.new(1,0,0) or Color3.new(0,2/3,0)) end function CalculateSpeed() --This function calculates the current speed while Selected do if EngineOn then CurrentSpeed = (CurrentSpeed < DesiredSpeed and CurrentSpeed + 2 or CurrentSpeed - 2) --A simple ternary operation that calculates the currentspeed CurrentSpeed = (CurrentSpeed < 0 and 0 or CurrentSpeed > MaxSpeed2 and MaxSpeed2 or CurrentSpeed) --This fixes the currentspeed end wait(0.5 - (Acceleration2/2000)) end end function GetLowestPoint() --This function gets the lowest point of the plane if (#LandingGear == 0) then LowestPoint = (Engine.Position.Y + 5 + (Engine.Size.Y/2)) return end for i,v in pairs(LandingGear) do local Set0 = (Engine.Position.Y - (v.CFrame * CFrame.new((v.Size.X/2),0,0)).Y) local Set1 = (Engine.Position.Y - (v.CFrame * CFrame.new(-(v.Size.X/2),0,0)).Y) local Set2 = (Engine.Position.Y - (v.CFrame * CFrame.new(0,(v.Size.Y/2),0)).Y) local Set3 = (Engine.Position.Y - (v.CFrame * CFrame.new(0,-(v.Size.Y/2),0)).Y) local Set4 = (Engine.Position.Y - (v.CFrame * CFrame.new(0,0,(v.Size.Z/2))).Y) local Set5 = (Engine.Position.Y - (v.CFrame * CFrame.new(0,0,-(v.Size.Z/2))).Y) local Max = (math.max(Set0,Set1,Set2,Set3,Set4,Set5) + 5) LowestPoint = (Max > LowestPoint and Max or LowestPoint) end end function GetBankAngle(M) --This function calculates the Bank Angle local VSX,X = M.ViewSizeX,M.X local Ratio = (((VSX/2) - X)/(VSX/2)) Ratio = (Ratio < -1 and -1 or Ratio > 1 and 1 or Ratio) return math.rad(Ratio * MaxBank2) end function Taxi() --This function determines whether the plane is taxiing or not local Ray = Ray.new(Engine.Position,Vector3.new(0,-LowestPoint,0)) return (TrueAirSpeed <= StallSpeed2 and game.Workspace:FindPartOnRay(Ray,Plane)) end function Stall() --This function determines whether the plane is stalling or not return ((AltRestrict.Value and Engine.Position.Y > MaxAltitude2) or TrueAirSpeed < StallSpeed2) end function FlyMain(M) --This is the main flying function if Selected then local BankAngle = GetBankAngle(M) --This uses the "GetBankAngle" function to calculate the Bank Angle local Taxi,Stall = Taxi(),Stall() if EngineOn then Engine.Thrust.velocity = (Engine.CFrame.lookVector * CurrentSpeed) + Vector3.new(0,0.15,0) if Taxi then if (CurrentSpeed < 2) then Thrust.maxForce = Vector3.new(0,0,0) Direction.maxTorque = Vector3.new(0,0,0) else Thrust.maxForce = Vector3.new(math.huge,0,math.huge) Direction.maxTorque = Vector3.new(0,math.huge,0) Direction.cframe = CFrame.new(Engine.Position,M.Hit.p) end elseif Stall then Thrust.maxForce = Vector3.new(0,0,0) Direction.maxTorque = Vector3.new(math.huge,math.huge,math.huge) Direction.cframe = (M.Hit*CFrame.Angles(0,0,BankAngle)) else Thrust.maxForce = Vector3.new(math.huge,math.huge,math.huge) Direction.maxTorque = Vector3.new(math.huge,math.huge,math.huge) Direction.cframe = (M.Hit*CFrame.Angles(0,0,BankAngle)) end if ((AltRestrict.Value) and (Engine.Position.Y < MinAltitude2)) then --If there are altitude restrictions and you are below it... AutoCrash.Value = true end elseif (not EngineOn) then Thrust.maxForce = Vector3.new(0,0,0) Thrust.velocity = Vector3.new(0,0,0) Direction.maxTorque = Vector3.new(0,0,0) end TrueAirSpeed = Engine.Velocity.magnitude UpdateGui(Taxi,Stall) --This activates the "UpdateGui" function]] wait() end end function onKeyDown(Key) --This function is activated whenever a key is pressed Key:lower() if (Key == FlightControls.Engine.Value) then --If you press the engine key... local Gui = GuiClone.Main if (not EngineOn) then EngineOn = true DesiredSpeed = 0 CurrentSpeed = 0 Throttle = 0 Gui.Engine.Visible = false CalculateSpeed() elseif EngineOn then EngineOn = false DesiredSpeed = 0 CurrentSpeed = 0 Throttle = 0 Gui.Engine.Visible = true end end if (Key == FlightControls.Gear.Value) then --If you press the change gear key... local Gui = GuiClone.Main local Taxiing = Taxi() if (#LandingGear ~= 0) then if (not Taxiing) then ChangeGear() if (not GearUp) then GearUp = true Gui.Gear.Text = "Gear Up" elseif GearUp then GearUp = false Gui.Gear.Text = "Gear Down" end end end end if SUAK and Key:byte() == SpeedUp2 or (not SUAK) and (Key == SpeedUp2) then --If you press the speed up key... Accelerating = true IncreaseSpd() end if SDAK and Key:byte() == SlowDown2 or (not SDAK) and (Key == SlowDown2) then --If you press the slow down key... Decelerating = true DecreaseSpd() end if (Key == TargetControls.Modes.Value) then --If you press the change modes key... if Targetable2 then if EngineOn then if (not Targeting) then Targeting = true elseif Targeting then Targeting = false Locked = false AimGui.Enabled = false LockGui.Enabled = false end end end end if (Key == FlightControls.Eject.Value:lower()) then if EngineOn then local Taxiing = Taxi() if (not Taxiing) then if Ejectable.Value then if (not Plane.Ejected.Value) then Plane.Ejected.Value = true local Seat = MainParts.Seat local EjectClone = Tool.Ejector:clone() EjectClone.Parent = Player.PlayerGui EjectClone.Disabled = false local Fire = Instance.new("Fire") Fire.Parent = Engine Fire.Heat = 25 Fire.Size = 30 local Smoke = Instance.new("Smoke") Smoke.Parent = Engine Smoke.Color = Color3.new(1/3,1/3,1/3) Smoke.Opacity = 0.7 Smoke.RiseVelocity = 10 Smoke.Size = 10 Seat.SeatWeld:remove() end end end end end if (Key == FlightControls.LockCam.Value) then LockedCam = (not LockedCam) end if (Key == WeaponControls.FireGuns.Value) then --If you press the fire guns key... if WeaponsValue.Value then --If there are weapons... if WeaponsValue.Guns.Value then --If there are guns... if EngineOn then local Taxiing = Taxi() if (not Taxiing) then --This prevents you from firing the gun while your on the ground FiringGun = true FireMachineGun(Weapons) --This activates the "FireMachineGun" function end end end end end if (Key == WeaponControls.FireRockets.Value) then --If you press the fire rockets key... if WeaponsValue.Value then if WeaponsValue.Rockets.Value then local Taxiing = Taxi() if (not Taxiing) then if RocketEnabled then RocketEnabled = false FireRockets(Weapons) ReloadRocket(RocketTime2) end end end end end if (Key == WeaponControls.DeployFlares.Value) then --If you press the deploy flares key... if WeaponsValue.Value then if WeaponsValue.Flares.Value then if EngineOn then local Taxiing = Taxi() if (not Taxiing) then if FlareEnabled then --This makes the plane deploy flares 5 times every 0.2 seconds before you have to reload FlareEnabled = false for i = 1,5 do DeployFlares(Weapons) wait(0.2) end ReloadFlare(FlareTime2) end end end end end end if (Key == WeaponControls.DropBombs.Value) then --If you press the drop bombs key... if WeaponsValue.Value then if WeaponsValue.Bombs.Value then if EngineOn then local Taxiing = Taxi() if (not Taxiing) then if BombEnabled then BombEnabled = false local BombSpawns = {} for i,v in pairs(Weapons:GetChildren()) do if v:IsA("BasePart") then if v.Name == "BombSpawn" then table.insert(BombSpawns,v) end end end local CurrentSpawn = BombSpawns[math.random(1,#BombSpawns)] --This line selects a random bomb spawn if Locked then DropGuidedBomb(CurrentSpawn) ReloadBomb((BombTime2 * 2)) elseif (not Locked) then for i = 1,5 do DropBomb(Weapons) wait(0.3) end ReloadBomb(BombTime2) end end end end end end end if (Key == WeaponControls.FireMissile.Value) then --If you press the fire missile key... if WeaponsValue.Value then if WeaponsValue.Missiles.Value then if EngineOn then local Taxiing = Taxi() if (not Taxiing) then if MissileEnabled then MissileEnabled = false local MissileSpawns = {} for i,v in pairs(Weapons:GetChildren()) do if v:IsA("BasePart") then if v.Name == "MissileSpawn" then table.insert(MissileSpawns,v) end end end local CurrentSpawn = MissileSpawns[math.random(1,#MissileSpawns)] --This line selects a random missile spawn if Locked then FireGuidedMissile(CurrentSpawn) ReloadMissile((MissileTime2 * 2)) elseif (not Locked) then FireMissile(CurrentSpawn) ReloadMissile(MissileTime2) end end end end end end end if (Key == TargetControls.UnTarget.Value) then --If you press the untarget key... if Targetable2 then if Locked then Locked = false end end end end function onKeyUp(Key) --This function is activated when you let go of a key Key:lower() if SUAK and Key:byte() == SpeedUp2 or (not SUAK) and (Key == SpeedUp2) then --If you let go of the speed up key... Accelerating = false end if SDAK and Key:byte() == SlowDown2 or (not SDAK) and (Key == SlowDown2) then --If you let go of the slow down key... Decelerating = false end if (Key == WeaponControls.FireGuns.Value) then --If you let go of the fire guns key... FiringGun = false end end function onSelected(mouse) --This function is activated when you select the Plane tool Selected = true mouse2 = mouse FixVars() --This activates the "FixVars" function GetGear(Gear) --This activates the "GetGear" function GetLowestPoint() --This activates the "GetLowestPoint" function ToolSelect.Value = true GuiClone = GUI:clone() --This line and the next one clones the plane gui and puts it into the player GuiClone.Parent = Player.PlayerGui SetUpGui() --This activates the "SetUpGui" function Camera.CameraType = CameraType2 --This makes your cameratype the customize cameratype if Targetable2 then --If the plane can target, then it will create the objects required for targeting AimGui = Instance.new("BillboardGui",Player.PlayerGui) AimGui.AlwaysOnTop = true AimGui.Enabled = false AimGui.Size = UDim2.new(0,50,0,50) local Label = Instance.new("ImageLabel",AimGui) Label.BackgroundTransparency = 1 Label.Image = "http://www.roblox.com/asset/?id=107388694" Label.Size = UDim2.new(1,0,1,0) LockGui = Instance.new("BillboardGui",Player.PlayerGui) LockGui.AlwaysOnTop = true LockGui.Enabled = false LockGui.Size = UDim2.new(0,50,0,50) local Label = Instance.new("ImageLabel",LockGui) Label.BackgroundTransparency = 1 Label.Image = "http://www.roblox.com/asset/?id=107388656" Label.Size = UDim2.new(1,0,1,0) end mouse.Icon = NormalCursor FTab[1] = mouse.Move:connect(function() onMouseMoved(mouse) end) --Lines 1025-1029 activate the given functions FTab[2] = mouse.Idle:connect(function() onMouseMoved(mouse) end) FTab[3] = mouse.Button1Down:connect(function() onButton1Down(mouse) end) FTab[4] = mouse.KeyDown:connect(onKeyDown) FTab[5] = mouse.KeyUp:connect(onKeyUp) FTab[6] = RunService.RenderStepped:connect(UpdateCamera) FTab[7] = RunService.Stepped:connect(function() FlyMain(mouse) end) end function onDeselected(mouse) --This function is activated when you deselect the Plane tool Selected = false LockedCam = false for i,v in pairs(FTab) do --This disconnects all the connections. It prevents bugs if v then v:disconnect() end end Camera.CameraType = Enum.CameraType.Custom --This makes the CameraType "Custom" Camera.CameraSubject = Character.Humanoid if Targetable2 then --If the plane can target, then the objects required for targeting will be removed AimGui:remove() LockGui:remove() end if (not Taxi()) and EngineOn then --If you're not Taxiing and your engine is on... if (not Deselect0.Value) and (not Plane.Ejected.Value) then --If you deselected the tool and didn't eject... onDeselectFlying() end end CurrentSpeed = 0 --Lines 1041-1054 resets the plane, the plane gui, and the plane tool DesiredSpeed = 0 TrueAirSpeed = 0 EngineOn = false Updating = false Locked = false Targeting = false TargetPlayer = nil ToolSelect.Value = false GuiAVisible = true GuiBVisible = true GuiClone:remove() Engine.Thrust.velocity = Vector3.new(0,0,0) Engine.Thrust.maxForce = Vector3.new(0,0,0) Engine.Direction.maxTorque = Vector3.new(0,0,0) end function onDeselectFlying() --This function blows up the plane if (not Deselect0.Value) then local Explosion = Instance.new("Explosion") Explosion.Parent = game.Workspace Explosion.Position = Engine.Position Explosion.BlastRadius = Plane:GetModelSize().magnitude Explosion.BlastPressure = 100000 Character.Humanoid.Health = 0 Engine.Thrust:remove() Engine.Direction:remove() delay(5,function() Plane:Destroy() end) end end function onDeselectForced() --This function is activated when you get out of the plane without deselecting the tool first if Deselect0.Value then onDeselected() mouse2.Icon = "rbxasset://textures\\ArrowCursor.png" --This makes the mouse icon the normal icon end end script.Parent.Selected:connect(onSelected) --The next 3 lines activate the given functions script.Parent.Deselected:connect(onDeselected) Deselect0.Changed:connect(onDeselectForced)
--[[ The Module ]]
-- local BaseOcclusion = require(script.Parent:WaitForChild("BaseOcclusion")) local Poppercam = setmetatable({}, BaseOcclusion) Poppercam.__index = Poppercam function Poppercam.new() local self = setmetatable(BaseOcclusion.new(), Poppercam) self.camera = nil self.cameraSubjectChangeConn = nil self.subjectPart = nil self.playerCharacters = {} -- For ignoring in raycasts self.vehicleParts = {} -- Also just for ignoring self.lastPopAmount = 0 self.lastZoomLevel = 0 self.popperEnabled = false return self end function Poppercam:GetOcclusionMode() return Enum.DevCameraOcclusionMode.Zoom end function Poppercam:Enable(enable) end
-- ================================================================================ -- Settings -- ================================================================================
local Settings = {} Settings.DefaultSpeed = 150 -- Speed when not boosted [Studs/second, Range 50-300] Settings.BoostSpeed = 200 -- Speed when boosted [Studs/second, Maximum: 400] Settings.BoostAmount = 10 -- Duration of boost in seconds Settings.Steering = 5 -- How quickly the speeder turns [Range: 1-10]
--[[Engine (Avxnturador)]]
-- Everything below can be illustrated and tuned with the graph below. -- https://www.desmos.com/calculator/oishj9m1tq -- This includes everything, from the engines, to boost, to electric. -- To import engines prior to AC6C V1.3, consult the README. -- Naturally Aspirated Engine Tune.Engine = true Tune.Horsepower = 970 Tune.IdleRPM = 750 Tune.PeakRPM = 6800 Tune.Redline = 8000 Tune.EqPoint = 5252 Tune.PeakSharpness = 10 Tune.CurveMult = 0.4 -- Electric Engine Tune.Electric = true Tune.E_Redline = 12700 Tune.E_Trans1 = 4000 Tune.E_Trans2 = 7000 -- Horsepower Tune.E_Horsepower = 223 Tune.EH_FrontMult = 0.15 Tune.EH_EndMult = 2.9 Tune.EH_EndPercent = 7 -- Torque Tune.E_Torque = 286 Tune.ET_EndMult = 1.505 Tune.ET_EndPercent = 27.5 -- Turbocharger Tune.Turbochargers = 2 -- Number of turbochargers in the engine -- Set to 0 for no turbochargers Tune.T_Boost = 25 Tune.T_Efficiency = 8.5 Tune.T_Size = 80 -- Turbo Size; Bigger size = more turbo lag -- Supercharger Tune.Superchargers = 0 -- Number of superchargers in the engine -- Set to 0 for no superchargers Tune.S_Boost = 7 Tune.S_Efficiency = 8.5 Tune.S_Sensitivity = 0.05 -- Supercharger responsiveness/sensitivity, applied per tick (recommended values between 0.05 to 0.1) --Misc Tune.ThrotAccel = .05 -- Throttle acceleration, applied per tick (recommended values between 0.05 to 0.1) Tune.ThrotDecel = .2 -- Throttle deceleration, applied per tick (recommended values between 0.1 to 0.3) Tune.BrakeAccel = .2 -- Brake acceleration, applied per tick Tune.BrakeDecel = .5 -- Brake deceleration, applied per tick Tune.RevAccel = 250 -- 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.Flywheel = 500 -- Flywheel weight (higher = faster response, lower = more stable RPM) Tune.InclineComp = 1 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
------ Programmed by BuildIntoGames; Removing this line will kill 5 children
--[[[Default Controls]]
--Peripheral Deadzones Tune.Peripherals = { MSteerWidth = 67 , -- Mouse steering control width (0 - 100% of screen width) MSteerDZone = 10 , -- Mouse steering deadzone (0 - 100%) ControlLDZone = 5 , -- Controller steering L-deadzone (0 - 100%) ControlRDZone = 5 , -- Controller steering R-deadzone (0 - 100%) } --Control Mapping Tune.Controls = { --Keyboard Controls --Mode Toggles ToggleABS = Enum.KeyCode.Y , ToggleTransMode = Enum.KeyCode.Q , --Primary Controls Throttle = Enum.KeyCode.Up , Brake = Enum.KeyCode.Down , SteerLeft = Enum.KeyCode.Left , SteerRight = Enum.KeyCode.Right , --Secondary Controls Throttle2 = Enum.KeyCode.W , Brake2 = Enum.KeyCode.S , SteerLeft2 = Enum.KeyCode.A , SteerRight2 = Enum.KeyCode.D , --Manual Transmission ShiftUp = Enum.KeyCode.E , ShiftDown = Enum.KeyCode.Q , Clutch = Enum.KeyCode.LeftShift , --Handbrake PBrake = Enum.KeyCode.P , --Mouse Controls MouseThrottle = Enum.UserInputType.MouseButton1 , MouseBrake = Enum.UserInputType.MouseButton2 , MouseClutch = Enum.KeyCode.W , MouseShiftUp = Enum.KeyCode.E , MouseShiftDown = Enum.KeyCode.Q , MousePBrake = Enum.KeyCode.LeftShift , --Controller Mapping ContlrThrottle = Enum.KeyCode.ButtonR2 , ContlrBrake = Enum.KeyCode.ButtonL2 , ContlrSteer = Enum.KeyCode.Thumbstick1 , ContlrShiftUp = Enum.KeyCode.ButtonY , ContlrShiftDown = Enum.KeyCode.ButtonX , ContlrClutch = Enum.KeyCode.ButtonR1 , ContlrPBrake = Enum.KeyCode.ButtonL1 , ContlrToggleTMode = Enum.KeyCode.DPadUp , ContlrToggleTCS = Enum.KeyCode.DPadDown , ContlrToggleABS = Enum.KeyCode.DPadRight , }
-- A symbol that represents the absence of a value.
export type None = PubTypes.Symbol & { -- name: "None" (add this when Luau supports singleton types) }
--[=[ Creates a promise from a signal @param signal Signal<T> @return Promise<T> ]=]
function PromiseUtils.fromSignal(signal) local promise = Promise.new() local conn promise:Finally(function() conn:Disconnect() conn = nil end) conn = signal:Connect(function(...) promise:Resolve(...) end) return promise end
-- / Configurations / --
local Configuration = Gun.Configuration
--------------------------CHARACTER CONTROL-------------------------------
local CurrentIgnoreList local function GetCharacter() return Player and Player.Character end local function GetTorso() local humanoid = findPlayerHumanoid(Player) return humanoid and humanoid.Torso end local function getIgnoreList() if CurrentIgnoreList then return CurrentIgnoreList end CurrentIgnoreList = {} table.insert(CurrentIgnoreList, GetCharacter()) return CurrentIgnoreList end
-- Only change the number below! --
local jumpCooldown = 2.0 -- Change this to the cooldown for every jump (decimals accepted)
--important stuff to register what is what. you need these if you want to do stuff with the tool itself.
Tool.Activated:connect(Activated) Tool.Equipped:connect(Equipped) Tool.Unequipped:connect(Unequipped) Handle.Touched:connect(Blow)
--------RIGHT DOOR --------
game.Workspace.doorright.l11.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value) game.Workspace.doorright.l22.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value) game.Workspace.doorright.l33.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value) game.Workspace.doorright.l41.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value) game.Workspace.doorright.l52.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value) game.Workspace.doorright.l63.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value) game.Workspace.doorright.l71.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value) game.Workspace.doorright.l43.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorright.l61.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorright.l53.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorright.l72.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorright.l62.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorright.l51.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorright.l21.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorright.l31.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorright.l12.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorright.l13.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorright.l32.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorright.l23.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorright.l42.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorright.l73.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorright.pillar.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
-- Menus
function Icon:setMenu(arrayOfIcons) -- Reset any previous icons for i, otherIcon in pairs(self.menuIcons) do otherIcon:leave() end -- Apply new icons if type(arrayOfIcons) == "table" then for i, otherIcon in pairs(arrayOfIcons) do otherIcon:join(self, "menu", true) end end -- Update menu self:_updateMenu() return self end function Icon:_getMenuDirection() local direction = (self:get("menuDirection") or "_NIL"):lower() local alignment = (self:get("alignment") or "_NIL"):lower() if direction ~= "left" and direction ~= "right" then direction = (alignment == "left" and "right") or "left" end return direction end function Icon:_updateMenu() local values = { maxIconsBeforeScroll = self:get("menuMaxIconsBeforeScroll") or "_NIL", direction = self:get("menuDirection") or "_NIL", iconAlignment = self:get("alignment") or "_NIL", scrollBarThickness = self:get("menuScrollBarThickness") or "_NIL", } for k, v in pairs(values) do if v == "_NIL" then return end end local XPadding = IconController[values.iconAlignment.."Gap"]--12 local menuContainer = self.instances.menuContainer local menuFrame = self.instances.menuFrame local menuList = self.instances.menuList local totalIcons = #self.menuIcons local direction = self:_getMenuDirection() local lastVisibleIconIndex = (totalIcons > values.maxIconsBeforeScroll and values.maxIconsBeforeScroll) or totalIcons local newCanvasSizeX = -XPadding local newFrameSizeX = 0 local newMinHeight = 0 local sortFunc = (direction == "right" and function(a,b) return a:get("order") < b:get("order") end) or function(a,b) return a:get("order") > b:get("order") end table.sort(self.menuIcons, sortFunc) for i = 1, totalIcons do local otherIcon = self.menuIcons[i] local otherIconSize = otherIcon:get("iconSize") local increment = otherIconSize.X.Offset + XPadding if i <= lastVisibleIconIndex then newFrameSizeX = newFrameSizeX + increment end if i == lastVisibleIconIndex and i ~= totalIcons then newFrameSizeX = newFrameSizeX -2--(increment/4) end newCanvasSizeX = newCanvasSizeX + increment local otherIconHeight = otherIconSize.Y.Offset if otherIconHeight > newMinHeight then newMinHeight = otherIconHeight end -- This ensures the menu is navigated fully and correctly with a controller local prevIcon = self.menuIcons[i-1] local nextIcon = self.menuIcons[i+1] otherIcon.instances.iconButton.NextSelectionRight = prevIcon and prevIcon.instances.iconButton otherIcon.instances.iconButton.NextSelectionLeft = nextIcon and nextIcon.instances.iconButton end local canvasSize = (lastVisibleIconIndex == totalIcons and 0) or newCanvasSizeX + XPadding self:set("menuCanvasSize", UDim2.new(0, canvasSize, 0, 0)) self:set("menuSize", UDim2.new(0, newFrameSizeX, 0, newMinHeight + values.scrollBarThickness + 3)) -- Set direction local directionDetails = { left = { containerAnchorPoint = Vector2.new(1, 0), containerPosition = UDim2.new(0, -4, 0, 0), canvasPosition = Vector2.new(canvasSize, 0) }, right = { containerAnchorPoint = Vector2.new(0, 0), containerPosition = UDim2.new(1, XPadding-2, 0, 0), canvasPosition = Vector2.new(0, 0), } } local directionDetail = directionDetails[direction] menuContainer.AnchorPoint = directionDetail.containerAnchorPoint menuContainer.Position = directionDetail.containerPosition menuFrame.CanvasPosition = directionDetail.canvasPosition self._menuCanvasPos = directionDetail.canvasPosition menuList.Padding = UDim.new(0, XPadding) end function Icon:_menuIgnoreClipping() self:_ignoreClipping("menu") end
--[[** ensures value is an array of a strict makeup and size @param check The check to compare all values with @returns A function that will return true iff the condition is passed **--]]
function t.strictArray(...) local valueTypes = { ... } assert(t.array(t.callback)(valueTypes)) return function(value) local keySuccess, keyErrMsg = arrayKeysCheck(value) if keySuccess == false then return false, string.format("[strictArray] %s", keyErrMsg or "") end -- If there's more than the set array size, disallow if #valueTypes < #value then return false, string.format("[strictArray] Array size exceeds limit of %d", #valueTypes) end for idx, typeFn in valueTypes do local typeSuccess, typeErrMsg = typeFn(value[idx]) if not typeSuccess then return false, string.format("[strictArray] Array index #%d - %s", idx, typeErrMsg) end end return true end end end do local callbackArray = t.array(t.callback)
--s.Pitch = 0.7
while s.Pitch<0.6 do s.Pitch=s.Pitch+0.010 s:Play() if s.Pitch>0.6 then s.Pitch=0.6 end wait(0.001) end
--Tool.Equipped:connect(OnEquipped) --Tool.Changed:connect(OnChanged)
Tool = script.Parent mouse = game.Players.LocalPlayer:GetMouse() colors = {45, 119, 21, 24, 23, 105, 104} function fire(v) script.Parent.fire:FireServer(v) end Tool.Enabled = true function onActivated() if not Tool.Enabled then return end Tool.Enabled = false local character = Tool.Parent; local humanoid = character.Humanoid if humanoid == nil then print("Humanoid not found") return end local targetPos = humanoid.TargetPoint local lookAt = (mouse.Hit.p - character.Head.Position).unit fire(lookAt) wait(.5) Tool.Enabled = true end script.Parent.Activated:connect(onActivated)
--[[ Initialization ]]
-- -- TODO: Remove when safe! ContextActionService crashes touch clients with tupele is 2 or more if not UserInputService.TouchEnabled then initialize() if isShiftLockMode() then InputCn = UserInputService.InputBegan:connect(onShiftInputBegan) IsActionBound = true end end
--// Script
for index,Weapon in pairs(Folder:GetChildren()) do local Clone = Template:Clone() Clone.Name = Weapon.Name Clone.Price.Value = Weapon.Price.Value Clone.NAME.Text = Weapon.Name Clone.COST.Text = Weapon.Price.Value Clone.Parent = script.Parent Clone.Visible = true end
----- Private Variables -----
local ActiveProfileStores = ProfileService._active_profile_stores local AutoSaveList = ProfileService._auto_save_list local IssueQueue = ProfileService._issue_queue local DataStoreService = game:GetService("DataStoreService") local RunService = game:GetService("RunService") local PlaceId = game.PlaceId local JobId = game.JobId local AutoSaveIndex = 1 -- Next profile to auto save local LastAutoSave = os.clock() local LoadIndex = 0 local ActiveProfileLoadJobs = 0 -- Number of active threads that are loading in profiles local ActiveProfileSaveJobs = 0 -- Number of active threads that are saving profiles local CriticalStateStart = 0 -- os.clock() local IsStudio = RunService:IsStudio() local IsLiveCheckActive = false local UseMockDataStore = false local MockDataStore = ProfileService._mock_data_store -- Mock data store used when API access is disabled local UserMockDataStore = ProfileService._user_mock_data_store -- Separate mock data store accessed via ProfileStore.Mock local UseMockTag = {} local CustomWriteQueue = { --[[ [store] = { [key] = { LastWrite = os.clock(), Queue = {callback, ...}, CleanupJob = nil, }, ... }, ... --]] }
--SFX ID to Sound object
local Sounds = {} local SoundService = game:GetService("SoundService") do local Figure = script.Parent.Parent Head = Figure:WaitForChild("Head") while not Humanoid do for _,NewHumanoid in pairs(Figure:GetChildren()) do if NewHumanoid:IsA("Humanoid") then Humanoid = NewHumanoid break end end if Humanoid then break end Figure.ChildAdded:wait() end Sounds[SFX.Died] = Head:WaitForChild("Died") Sounds[SFX.Running] = Head:WaitForChild("Running") Sounds[SFX.Swimming] = Head:WaitForChild("Swimming") Sounds[SFX.Climbing] = Head:WaitForChild("Climbing") Sounds[SFX.Jumping] = Head:WaitForChild("Jumping") Sounds[SFX.GettingUp] = Head:WaitForChild("GettingUp") Sounds[SFX.FreeFalling] = Head:WaitForChild("FreeFalling") Sounds[SFX.Landing] = Head:WaitForChild("Landing") Sounds[SFX.Splash] = Head:WaitForChild("Splash") local DefaultServerSoundEvent = game:GetService("ReplicatedStorage"):FindFirstChild("DefaultServerSoundEvent") if DefaultServerSoundEvent then DefaultServerSoundEvent.OnClientEvent:connect(function(sound, playing, resetPosition) if UserSettings():IsUserFeatureEnabled("UserPlayCharacterLoopSoundWhenFE") then if resetPosition and sound.TimePosition ~= 0 then sound.TimePosition = 0 end if sound.IsPlaying ~= playing then sound.Playing = playing end else if sound.TimePosition ~= 0 then sound.TimePosition = 0 end if not sound.IsPlaying then sound.Playing = true end end end) end end local IsSoundFilteringEnabled = function() return game.Workspace.FilteringEnabled and SoundService.RespectFilteringEnabled end local Util Util = { --Define linear relationship between (pt1x,pt2x) and (pt2x,pt2y). Evaluate this at x. YForLineGivenXAndTwoPts = function(x,pt1x,pt1y,pt2x,pt2y) --(y - y1)/(x - x1) = m local m = (pt1y - pt2y) / (pt1x - pt2x) --float b = pt1.y - m * pt1.x; local b = (pt1y - m * pt1x) return m * x + b end; --Clamps the value of "val" between the "min" and "max" Clamp = function(val,min,max) return math.min(max,math.max(min,val)) end; --Gets the horizontal (x,z) velocity magnitude of the given part HorizontalSpeed = function(Head) local hVel = Head.Velocity + Vector3.new(0,-Head.Velocity.Y,0) return hVel.magnitude end; --Gets the vertical (y) velocity magnitude of the given part VerticalSpeed = function(Head) return math.abs(Head.Velocity.Y) end; --Setting Playing/TimePosition values directly result in less network traffic than Play/Pause/Resume/Stop --If these properties are enabled, use them. Play = function(sound) if IsSoundFilteringEnabled() then sound.CharacterSoundEvent:FireServer(true, true) end if sound.TimePosition ~= 0 then sound.TimePosition = 0 end if not sound.IsPlaying then sound.Playing = true end end; Pause = function(sound) if UserSettings():IsUserFeatureEnabled("UserPlayCharacterLoopSoundWhenFE") and IsSoundFilteringEnabled() then sound.CharacterSoundEvent:FireServer(false, false) end if sound.IsPlaying then sound.Playing = false end end; Resume = function(sound) if UserSettings():IsUserFeatureEnabled("UserPlayCharacterLoopSoundWhenFE") and IsSoundFilteringEnabled() then sound.CharacterSoundEvent:FireServer(true, false) end if not sound.IsPlaying then sound.Playing = true end end; Stop = function(sound) if UserSettings():IsUserFeatureEnabled("UserPlayCharacterLoopSoundWhenFE") and IsSoundFilteringEnabled() then sound.CharacterSoundEvent:FireServer(false, true) end if sound.IsPlaying then sound.Playing = false end if sound.TimePosition ~= 0 then sound.TimePosition = 0 end end; } do -- List of all active Looped sounds local playingLoopedSounds = {} -- Last seen Enum.HumanoidStateType local activeState = nil -- Verify and set that "sound" is in "playingLoopedSounds". function setSoundInPlayingLoopedSounds(sound) for i=1, #playingLoopedSounds do if playingLoopedSounds[i] == sound then return end end table.insert(playingLoopedSounds,sound) end -- Stop all active looped sounds except parameter "except". If "except" is not passed, all looped sounds will be stopped. function stopPlayingLoopedSoundsExcept(except) for i=#playingLoopedSounds,1,-1 do if playingLoopedSounds[i] ~= except then Util.Pause(playingLoopedSounds[i]) table.remove(playingLoopedSounds,i) end end end -- Table of Enum.HumanoidStateType to handling function local stateUpdateHandler = { [Enum.HumanoidStateType.Dead] = function() stopPlayingLoopedSoundsExcept() local sound = Sounds[SFX.Died] Util.Play(sound) end; [Enum.HumanoidStateType.RunningNoPhysics] = function() stateUpdated(Enum.HumanoidStateType.Running) end; [Enum.HumanoidStateType.Running] = function() local sound = Sounds[SFX.Running] stopPlayingLoopedSoundsExcept(sound) if Util.HorizontalSpeed(Head) > 0.5 then Util.Resume(sound) setSoundInPlayingLoopedSounds(sound) else stopPlayingLoopedSoundsExcept() end end; [Enum.HumanoidStateType.Swimming] = function() if activeState ~= Enum.HumanoidStateType.Swimming and Util.VerticalSpeed(Head) > 0.1 then local splashSound = Sounds[SFX.Splash] splashSound.Volume = Util.Clamp( Util.YForLineGivenXAndTwoPts( Util.VerticalSpeed(Head), 100, 0.28, 350, 1), 0,1) Util.Play(splashSound) end do local sound = Sounds[SFX.Swimming] stopPlayingLoopedSoundsExcept(sound) Util.Resume(sound) setSoundInPlayingLoopedSounds(sound) end end; [Enum.HumanoidStateType.Climbing] = function() local sound = Sounds[SFX.Climbing] if Util.VerticalSpeed(Head) > 0.1 then Util.Resume(sound) stopPlayingLoopedSoundsExcept(sound) else stopPlayingLoopedSoundsExcept() end setSoundInPlayingLoopedSounds(sound) end; [Enum.HumanoidStateType.Jumping] = function() if activeState == Enum.HumanoidStateType.Jumping then return end stopPlayingLoopedSoundsExcept() local sound = Sounds[SFX.Jumping] Util.Play(sound) end; [Enum.HumanoidStateType.GettingUp] = function() stopPlayingLoopedSoundsExcept() local sound = Sounds[SFX.GettingUp] Util.Play(sound) end; [Enum.HumanoidStateType.Freefall] = function() if activeState == Enum.HumanoidStateType.Freefall then return end local sound = Sounds[SFX.FreeFalling] sound.Volume = 0 stopPlayingLoopedSoundsExcept() end; [Enum.HumanoidStateType.FallingDown] = function() stopPlayingLoopedSoundsExcept() end; [Enum.HumanoidStateType.Landed] = function() stopPlayingLoopedSoundsExcept() if Util.VerticalSpeed(Head) > 75 then local landingSound = Sounds[SFX.Landing] landingSound.Volume = Util.Clamp( Util.YForLineGivenXAndTwoPts( Util.VerticalSpeed(Head), 50, 0, 100, 1), 0,1) Util.Play(landingSound) end end; [Enum.HumanoidStateType.Seated] = function() stopPlayingLoopedSoundsExcept() end; } -- Handle state event fired or OnChange fired function stateUpdated(state) if stateUpdateHandler[state] ~= nil then stateUpdateHandler[state]() end activeState = state end Humanoid.Died:connect( function() stateUpdated(Enum.HumanoidStateType.Dead) end) Humanoid.Running:connect( function() stateUpdated(Enum.HumanoidStateType.Running) end) Humanoid.Swimming:connect( function() stateUpdated(Enum.HumanoidStateType.Swimming) end) Humanoid.Climbing:connect( function() stateUpdated(Enum.HumanoidStateType.Climbing) end) Humanoid.Jumping:connect( function() stateUpdated(Enum.HumanoidStateType.Jumping) end) Humanoid.GettingUp:connect( function() stateUpdated(Enum.HumanoidStateType.GettingUp) end) Humanoid.FreeFalling:connect( function() stateUpdated(Enum.HumanoidStateType.Freefall) end) Humanoid.FallingDown:connect( function() stateUpdated(Enum.HumanoidStateType.FallingDown) end) -- required for proper handling of Landed event Humanoid.StateChanged:connect(function(old, new) stateUpdated(new) end) function onUpdate(stepDeltaSeconds, tickSpeedSeconds) local stepScale = stepDeltaSeconds / tickSpeedSeconds do local sound = Sounds[SFX.FreeFalling] if activeState == Enum.HumanoidStateType.Freefall then if Head.Velocity.Y < 0 and Util.VerticalSpeed(Head) > 75 then Util.Resume(sound) --Volume takes 1.1 seconds to go from volume 0 to 1 local ANIMATION_LENGTH_SECONDS = 1.1 local normalizedIncrement = tickSpeedSeconds / ANIMATION_LENGTH_SECONDS sound.Volume = Util.Clamp(sound.Volume + normalizedIncrement * stepScale, 0, 1) else sound.Volume = 0 end else Util.Pause(sound) end end do local sound = Sounds[SFX.Running] if activeState == Enum.HumanoidStateType.Running then if Util.HorizontalSpeed(Head) < 0.5 then Util.Pause(sound) end end end end local lastTick = tick() local TICK_SPEED_SECONDS = 0.25 while true do onUpdate(tick() - lastTick,TICK_SPEED_SECONDS) lastTick = tick() wait(TICK_SPEED_SECONDS) end end
-- ROBLOX scripter hackers, see what you can do with this: -- game:GetService("BadgeService"):UserHasBadge(userid, badgeid)
function OnTouch(part) if (part.Parent:FindFirstChild("Humanoid") ~= nil) then local p = game.Players:GetPlayerFromCharacter(part.Parent) if (p ~= nil) then print("Awarding BadgeID: " ..script.Parent.BadgeID.Value .. " to UserID: " .. p.userId) local b = game:GetService("BadgeService") b:AwardBadge(p.userId, script.Parent.BadgeID.Value) end end end script.Parent.Touched:connect(OnTouch)
--Sizes
local xsize = script.Parent.Size.X local ysize = script.Parent.Size.Y local zsize = script.Parent.Size.Z
-- If in-game, enable ctrl hotkeys for cloning and deleting
if Mode == 'Tool' then AssignHotkey({ 'LeftControl', 'C' }, CloneSelection); AssignHotkey({ 'RightControl', 'C' }, CloneSelection); AssignHotkey({ 'LeftControl', 'X' }, DeleteSelection); AssignHotkey({ 'RightControl', 'X' }, DeleteSelection); end;
--| Remote |--
local Remote = Replicated.Access.Remotes
-- Main loop for the entire game
while true do displayManager.updateStatus("Waiting for Players") displayManager.updateTime(0) repeat wait(1) until Players.NumPlayers >= gameSettings.minimumPlayers -- Actual Intermission displayManager.updateStatus("Intermission") gameTimer:start(gameSettings.intermissionDuration) displayManager.trackTimer(gameTimer) gameTimer.finished:Wait() roundManager.prepareGame() displayManager.updateStatus("Round in Progress") -- Waits until the roundEnd event has fired before continuing the script local endState = roundEnd.Event:Wait() -- Displays how the game ended to the player's GUI. Ex: Winner found, time up ... local resultString = roundManager.endRound() displayRoundResult:FireAllClients(resultString) -- Starts the end intermission. Will remove player weapons if still actively in game. displayManager.updateTime(0) wait(gameSettings.transitionEnd) roundManager.endGameIntermission() -- Resets the game by moving players back into the lobby and clearing used variables roundManager.resetGame() end
--[=[ @prop Util Folder @within KnitClient @readonly References the Util folder. Should only be accessed when using Knit as a standalone module. If using Knit from Wally, modules should just be pulled in via Wally instead of relying on Knit's Util folder, as this folder only contains what is necessary for Knit to run in Wally mode. ]=]
KnitClient.Util = script.Parent.Parent local Promise = require(KnitClient.Util.Promise) local Comm = require(KnitClient.Util.Comm) local ClientComm = Comm.ClientComm local controllers: {[string]: Controller} = {} local services: {[string]: Service} = {} local servicesFolder = nil local started = false local startedComplete = false local onStartedComplete = Instance.new("BindableEvent") local function DoesControllerExist(controllerName: string): boolean local controller: Controller? = controllers[controllerName] return controller ~= nil end local function GetServicesFolder() if not servicesFolder then servicesFolder = script.Parent:WaitForChild("Services") end return servicesFolder end local function GetMiddlewareForService(serviceName: string) local knitMiddleware = selectedOptions.Middleware or {} local serviceMiddleware = selectedOptions.PerServiceMiddleware[serviceName] return serviceMiddleware or knitMiddleware end local function BuildService(serviceName: string) local folder = GetServicesFolder() local middleware = GetMiddlewareForService(serviceName) local clientComm = ClientComm.new(folder, selectedOptions.ServicePromises, serviceName) local service = clientComm:BuildObject(middleware.Inbound, middleware.Outbound) services[serviceName] = service return service end
-- Provide functionality to the server API endpoint instance
ServerEndpoint.OnServerInvoke = function (Client, ...) return SyncModule.PerformAction(Client, ...); end;
--[=[ @param trigger KeyCode @param deadzoneThreshold number? @return number Gets the position of the given trigger. The triggers are usually going to be `Enum.KeyCode.ButtonL2` and `Enum.KeyCode.ButtonR2`. These trigger buttons are analog, and will output a value between the range of [0, 1]. If `deadzoneThreshold` is not included, the `DefaultDeadzone` value is used instead. ```lua local triggerAmount = gamepad:GetTrigger(Enum.KeyCode.ButtonR2) print(triggerAmount) ``` ]=]
function Gamepad:GetTrigger(trigger: Enum.KeyCode, deadzoneThreshold: number?): number return ApplyDeadzone(self.State[trigger].Position.Z, deadzoneThreshold or self.DefaultDeadzone) end
---------------------------------- ------------FUNCTIONS------------- ----------------------------------
function Receive(action, ...) local args = {...} if not ScriptReady then return end if action == "activate" then if not PlayingEnabled then Activate(args[1], args[2]) end elseif action == "deactivate" then if PlayingEnabled then Deactivate() end elseif action == "play" then if Player ~= args[1] then PlayNoteServer(args[2], args[3], args[4], args[5]) end end end function Activate(cameraCFrame, sounds) PlayingEnabled = true MakeHumanoidConnections() MakeKeyboardConnections() MakeGuiConnections() SetCamera(cameraCFrame) SetSounds(sounds) ShowPiano() end function Deactivate() PlayingEnabled = false BreakHumanoidConnections() BreakKeyboardConnections() BreakGuiConnections() HidePiano() HideSheets() ReturnCamera() Jump() end function PlayNoteClient(note) PlayNoteSound(note) HighlightPianoKey(note) Connector:FireServer("play", note) end function PlayNoteServer(note, point, range) PlayNoteSound(note, point, range) end function Abort() Connector:FireServer("abort") end
--returns the wielding player of this tool
function getPlayer() local char = Tool.Parent return game:GetService("Players"):GetPlayerFromCharacter(Character) end function Toss(direction) local handlePos = Vector3.new(Tool.Handle.Position.X, 0, Tool.Handle.Position.Z) local spawnPos = Character.Head.Position spawnPos = spawnPos + (direction * 5) local Object = Tool.Handle:Clone() Object.Burn.Attachment.Debris.Enabled = true Object.ThinkFast:Destroy() Object.Parent = workspace Object.Swing.Pitch = Random.new():NextInteger(90, 110)/100 Object.Swing:Play() Object.CanCollide = true Object.CFrame = Tool.Handle.CFrame Object.Velocity = (direction*AttackVelocity) + Vector3.new(0,AttackVelocity/7.5,0) Object.Trail.Enabled = true local rand = 11.25 Object.RotVelocity = Vector3.new(Random.new():NextNumber(-rand,rand),Random.new():NextNumber(-rand,rand),Random.new():NextNumber(-rand,rand)) Object:SetNetworkOwner(getPlayer()) local ScriptClone = DamageScript:Clone() ScriptClone.Parent = Object ScriptClone.Disabled = false local tag = Instance.new("ObjectValue") tag.Value = getPlayer() tag.Name = "creator" tag.Parent = Object end PowerRemote.OnServerEvent:Connect(function(player, Power) local holder = getPlayer() if holder ~= player then return end AttackVelocity = Power end) TossRemote.OnServerEvent:Connect(function(player, mousePosition) local holder = getPlayer() if holder ~= player then return end if Cooldown.Value == true then return end Cooldown.Value = true if Humanoid and Humanoid.RigType == Enum.HumanoidRigType.R15 then TossRemote:FireClient(getPlayer(), "PlayAnimation", "Animation") end local targetPos = mousePosition.p local lookAt = (targetPos - Character.Head.Position).unit local SecretRNG = Random.new():NextInteger(1,10) --Change RNG value here if SecretRNG == 1 then local ChucklenutsSound = Tool.Handle.ThinkFast:Play() end Toss(lookAt) task.wait(CooldownTime) Cooldown.Value = false end) Tool.Equipped:Connect(function() Character = Tool.Parent Humanoid = Character:FindFirstChildOfClass("Humanoid") end) Tool.Unequipped:Connect(function() Character = nil Humanoid = nil end)
-- But in this script, the animation is loaded only ONCE.
Mouse.KeyDown:connect(function(key) key = string.lower(key) if string.byte(key) == 48 then s:Play() humanoid.WalkSpeed = 67 end end) Mouse.KeyUp:connect(function(key) key = string.lower(key) if string.byte(key) == 48 then s:Stop() humanoid.WalkSpeed = 7 end end)
--]]
function getHumanoid(model) for _, v in pairs(model:GetChildren()) do if v:IsA'Humanoid' then return v end end end local ai = script.Parent local human = getHumanoid(ai) local hroot = ai.HumanoidRootPart local zspeed = hroot.Velocity.magnitude local pfs = game:GetService("PathfindingService") function GetPlayerNames() local players = game:GetService('Players'):GetChildren() local name = nil for _, v in pairs(players) do if v:IsA'Player' then name = tostring(v.Name) end end return name end function GetPlayersBodyParts(t) local torso = t if torso then local figure = torso.Parent for _, v in pairs(figure:GetChildren()) do if v:IsA'Part' then return v.Name end end else return "HumanoidRootPart" end end function GetTorso(part) local chars = game.Workspace:GetChildren() local torso = nil for _, v in pairs(chars) do if v:IsA'Model' and v ~= script.Parent and v.Name == GetPlayerNames() and not v:FindFirstChild("Enemy") then local charRoot = v:FindFirstChild'HumanoidRootPart' if (charRoot.Position - part).magnitude < SearchDistance then torso = charRoot end end end return torso end for _, zambieparts in pairs(ai:GetChildren()) do if zambieparts:IsA'Part' then zambieparts.Touched:connect(function(p) if p.Parent.Name == GetPlayerNames() and p.Parent.Name ~= ai.Name then -- damage local enemy = p.Parent local enemyhuman = getHumanoid(enemy) enemyhuman:TakeDamage(aiDamage) end end) end end
--while wait() do
if char then game.StarterGui:SetCoreGuiEnabled(2,EnableBackpackGui) for i,v in ipairs(char:GetChildren()) do if v.className ~= ""..Weapon.."" then wait() if db == 1 then player.Character.Humanoid:EquipTool(tool) db=2 end end end script.Parent.Unequipped:connect(function() db=1 end) end
--Update list of players in admin panel
local selectPlrFrame = panel.Pages.MainButtonsFrame.ButtonsScroller.SelectPlayerFrame local scroller = selectPlrFrame.PlayersScroller local selectedFrame = selectPlrFrame.SelectedPlayerFrame selectedFrame.Visible = false function updatePlayers() for i, child in pairs(scroller:GetChildren()) do if child:IsA("TextButton") then child:Destroy() end end for i, plr in pairs(game.Players:GetPlayers()) do local btn = script.PlayerButton:Clone() local name = plr.Name btn.PlayerName.Text = name local image = game.Players:GetUserThumbnailAsync(plr.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size100x100) btn.PlayerImage.Image = image btn.MouseButton1Click:Connect(function() selectedFrame.PlayerName.Text = name selectedFrame.DisplayName.Text = "@" .. plr.DisplayName selectedFrame.UserId.Text = plr.UserId selectedFrame.InGame.Text = "Currently in server 🟢" selectedFrame.PlayerImage.Image = image selectedFrame.Visible = true end) btn.Parent = scroller end end updatePlayers() game.Players.PlayerAdded:Connect(updatePlayers) game.Players.PlayerRemoving:Connect(updatePlayers)
--[=[ @tag Component Class @return {Component} Gets a table array of all existing component objects. For example, if there was a component class linked to the "MyComponent" tag, and three Roblox instances in your game had that same tag, then calling `GetAll` would return the three component instances. ```lua local MyComponent = Component.new({Tag = "MyComponent"}) -- ... local components = MyComponent:GetAll() for _,component in ipairs(components) do component:DoSomethingHere() end ``` ]=]
function Component:GetAll() return self[KEY_COMPONENTS] end
--//////////////////////////////////////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////////// Code to do chat window fading --////////////////////////////////////////////////////////////////////////////////////////////
function CheckIfPointIsInSquare(checkPos, topLeft, bottomRight) return (topLeft.X <= checkPos.X and checkPos.X <= bottomRight.X and topLeft.Y <= checkPos.Y and checkPos.Y <= bottomRight.Y) end local backgroundIsFaded = false local textIsFaded = false local lastTextFadeTime = 0 local lastBackgroundFadeTime = 0 local fadedChanged = Instance.new("BindableEvent") local mouseStateChanged = Instance.new("BindableEvent") local chatBarFocusChanged = Instance.new("BindableEvent") function DoBackgroundFadeIn(setFadingTime) lastBackgroundFadeTime = tick() backgroundIsFaded = false fadedChanged:Fire() ChatWindow:FadeInBackground((setFadingTime or ChatSettings.ChatDefaultFadeDuration)) local currentChannelObject = ChatWindow:GetCurrentChannel() if (currentChannelObject) then local Scroller = MessageLogDisplay.Scroller Scroller.ScrollingEnabled = true Scroller.ScrollBarThickness = moduleMessageLogDisplay.ScrollBarThickness end end function DoBackgroundFadeOut(setFadingTime) lastBackgroundFadeTime = tick() backgroundIsFaded = true fadedChanged:Fire() ChatWindow:FadeOutBackground((setFadingTime or ChatSettings.ChatDefaultFadeDuration)) local currentChannelObject = ChatWindow:GetCurrentChannel() if (currentChannelObject) then local Scroller = MessageLogDisplay.Scroller Scroller.ScrollingEnabled = false Scroller.ScrollBarThickness = 0 end end function DoTextFadeIn(setFadingTime) lastTextFadeTime = tick() textIsFaded = false fadedChanged:Fire() ChatWindow:FadeInText((setFadingTime or ChatSettings.ChatDefaultFadeDuration) * 0) end function DoTextFadeOut(setFadingTime) lastTextFadeTime = tick() textIsFaded = true fadedChanged:Fire() ChatWindow:FadeOutText((setFadingTime or ChatSettings.ChatDefaultFadeDuration)) end function DoFadeInFromNewInformation() DoTextFadeIn() if ChatSettings.ChatShouldFadeInFromNewInformation then DoBackgroundFadeIn() end end function InstantFadeIn() DoBackgroundFadeIn(0) DoTextFadeIn(0) end function InstantFadeOut() DoBackgroundFadeOut(0) DoTextFadeOut(0) end local mouseIsInWindow = nil function UpdateFadingForMouseState(mouseState) mouseIsInWindow = mouseState mouseStateChanged:Fire() if (ChatBar:IsFocused()) then return end if (mouseState) then DoBackgroundFadeIn() DoTextFadeIn() else DoBackgroundFadeIn() end end spawn(function() while true do RunService.RenderStepped:wait() while (mouseIsInWindow or ChatBar:IsFocused()) do if (mouseIsInWindow) then mouseStateChanged.Event:wait() end if (ChatBar:IsFocused()) then chatBarFocusChanged.Event:wait() end end if (not backgroundIsFaded) then local timeDiff = tick() - lastBackgroundFadeTime if (timeDiff > ChatSettings.ChatWindowBackgroundFadeOutTime) then DoBackgroundFadeOut() end elseif (not textIsFaded) then local timeDiff = tick() - lastTextFadeTime if (timeDiff > ChatSettings.ChatWindowTextFadeOutTime) then DoTextFadeOut() end else fadedChanged.Event:wait() end end end) function getClassicChatEnabled() if ChatSettings.ClassicChatEnabled ~= nil then return ChatSettings.ClassicChatEnabled end return Players.ClassicChat end function getBubbleChatEnabled() if ChatSettings.BubbleChatEnabled ~= nil then return ChatSettings.BubbleChatEnabled end return Players.BubbleChat end function bubbleChatOnly() return not getClassicChatEnabled() and getBubbleChatEnabled() end function UpdateMousePosition(mousePos, ignoreForFadeIn) if not (moduleApiTable.Visible and moduleApiTable.IsCoreGuiEnabled and (moduleApiTable.TopbarEnabled or ChatSettings.ChatOnWithTopBarOff)) then return end if bubbleChatOnly() then return end local windowPos = ChatWindow.GuiObject.AbsolutePosition local windowSize = ChatWindow.GuiObject.AbsoluteSize local newMouseState = CheckIfPointIsInSquare(mousePos, windowPos, windowPos + windowSize) if FFlagFixChatWindowHoverOver then if ignoreForFadeIn and newMouseState == true then return end end if (newMouseState ~= mouseIsInWindow) then UpdateFadingForMouseState(newMouseState) end end UserInputService.InputChanged:connect(function(inputObject, gameProcessedEvent) if (inputObject.UserInputType == Enum.UserInputType.MouseMovement) then local mousePos = Vector2.new(inputObject.Position.X, inputObject.Position.Y) UpdateMousePosition(mousePos, --[[ ignoreForFadeIn = ]] gameProcessedEvent) end end) UserInputService.TouchTap:connect(function(tapPos, gameProcessedEvent) UpdateMousePosition(tapPos[1], --[[ ignoreForFadeIn = ]] false) end) UserInputService.TouchMoved:connect(function(inputObject, gameProcessedEvent) local tapPos = Vector2.new(inputObject.Position.X, inputObject.Position.Y) UpdateMousePosition(tapPos, --[[ ignoreForFadeIn = ]] false) end) if not FFlagFixMouseCapture then UserInputService.Changed:connect(function(prop) if prop == "MouseBehavior" then if UserInputService.MouseBehavior == Enum.MouseBehavior.LockCenter then local windowPos = ChatWindow.GuiObject.AbsolutePosition local windowSize = ChatWindow.GuiObject.AbsoluteSize local screenSize = GuiParent.AbsoluteSize local centerScreenIsInWindow = CheckIfPointIsInSquare(screenSize/2, windowPos, windowPos + windowSize) if centerScreenIsInWindow then UserInputService.MouseBehavior = Enum.MouseBehavior.Default end end end end) end
--Blood Parts Function
local createBlood = function(position) local randomSize = math.random(2, 20) / 10 local bloodClone = bloodPart:Clone() bloodClone.Position = position + Vector3.new(0, 0.05, 0) bloodClone.Size = Vector3.new(randomSize, 0.1, randomSize) bloodClone.Parent = bloodCache if math.random(2) == 1 then bloodClone.BloodSound:Play() end return bloodClone end
--[=[ This can't be cheap. Consider deeply if you want this or not. @param selectFromBrio ((value: T) -> U)? @return (source: Observable<Brio<T>>) -> Observable<Brio{U}> ]=]
function RxBrioUtils.reduceToAliveList(selectFromBrio) assert(type(selectFromBrio) == "function" or selectFromBrio == nil, "Bad selectFromBrio") return function(source) return Observable.new(function(sub) local topMaid = Maid.new() local subscribed = true topMaid:GiveTask(function() subscribed = false end) local aliveBrios = {} local fired = false local function updateBrios() if not subscribed then -- No work if we don't need to. return end aliveBrios = BrioUtils.aliveOnly(aliveBrios) local values = {} if selectFromBrio then for _, brio in pairs(aliveBrios) do -- Hope for no side effects local value = selectFromBrio(brio:GetValue()) assert(value ~= nil, "Bad value") table.insert(values, value) end else for _, brio in pairs(aliveBrios) do local value = brio:GetValue() assert(value ~= nil, "Bad value") table.insert(values, value) end end local newBrio = BrioUtils.first(aliveBrios, values) topMaid._lastBrio = newBrio fired = true sub:Fire(newBrio) end local function handleNewBrio(brio) -- Could happen due to throttle or delay... if brio:IsDead() then return end local maid = Maid.new() topMaid[maid] = maid -- Use maid as key so it's unique (reemitted brio) maid:GiveTask(function() -- GC properly topMaid[maid] = nil updateBrios() end) maid:GiveTask(brio:GetDiedSignal():Connect(function() topMaid[maid] = nil end)) table.insert(aliveBrios, brio) updateBrios() end topMaid:GiveTask(source:Subscribe( function(brio) if not Brio.isBrio(brio) then warn(("[RxBrioUtils.mergeToAliveList] - Not a brio, %q"):format(tostring(brio))) topMaid._lastBrio = nil sub:Fail("Not a brio") return end handleNewBrio(brio) end, function(...) sub:Fail(...) end, function(...) sub:Complete(...) end)) -- Make sure we emit an empty list if we discover nothing if not fired then updateBrios() end return topMaid end) end end
-- ActiveCast class type. -- The ActiveCast type represents a currently running cast.
--[[Transmission]]
Tune.TransModes = {"Auto", "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)
-- Module.
local _Confetti = {}; _Confetti.__index = _Confetti; -- Set the gravitational pull for the confetti. local gravity = Vector2.new(0,1); function _Confetti.setGravity(paramVec2) gravity = paramVec2; end; -- Create a confetti particle. function _Confetti.createParticle(paramEmitter, paramForce, paramParent, paramColors) local _Particle = {}; setmetatable(_Particle, _Confetti); colors = paramColors; -- Adjust forces. local xforce = paramForce.X; if (xforce < 0) then xforce = xforce * -1; end; local distanceFromZero = 0 - xforce; paramForce = Vector2.new(paramForce.X, paramForce.Y + (distanceFromZero * 0.75)); if (paramColors == nil) then paramColors = colors; end; -- Confetti data. _Particle.EmitterPosition = paramEmitter; _Particle.EmitterPower = paramForce; _Particle.Position = Vector2.new(0,0); _Particle.Power = paramForce; _Particle.Color = paramColors[math.random(#paramColors)]; local function getParticle() local label = shapes[math.random(#shapes)]:Clone(); label.ImageColor3 = _Particle.Color; label.Parent = paramParent; label.Rotation = math.random(360); label.Visible = true; label.ZIndex = 20; return label; end; _Particle.Label = getParticle(); _Particle.DefaultSize = 30; _Particle.Size = 1; _Particle.Side = -1; _Particle.OutOfBounds = false; _Particle.Enabled = false; _Particle.Cycles = 0; return _Particle; end; -- Update the position of the confetti. function _Confetti:Update(paramDeltaTime) if (self.Enabled and self.OutOfBounds) then self.Label.ImageColor3 = self.Color; self.Position = Vector2.new(0,0); self.Power = Vector2.new(self.EmitterPower.X + math.random(10)-5, self.EmitterPower.Y + math.random(10)-5); self.Cycles = self.Cycles + 1; end; if ( (not(self.Enabled) and self.OutOfBounds) or (not(self.Enabled) and (self.Cycles == 0))) then self.Label.Visible = false; self.OutOfBounds = true; self.Color = colors[math.random(#colors)]; return; else self.Label.Visible = true; end; local startPosition, currentPosition, currentPower = self.EmitterPosition, self.Position, self.Power; local imageLabel = self.Label; -- Apply change. if (imageLabel) then -- Update position. local newPosition = Vector2.new(currentPosition.X - currentPower.X, currentPosition.Y - currentPower.Y); local newPower = Vector2.new((currentPower.X/1.09) - gravity.X, (currentPower.Y/1.1) - gravity.Y); local ViewportSize = Camera.ViewportSize; imageLabel.Position = UDim2.new(startPosition.X, newPosition.X, startPosition.Y, newPosition.Y); self.OutOfBounds = (imageLabel.AbsolutePosition.X > ViewportSize.X and gravity.X > 0) or (imageLabel.AbsolutePosition.Y > ViewportSize.Y and gravity.Y > 0) or (imageLabel.AbsolutePosition.X < 0 and gravity.X < 0) or (imageLabel.AbsolutePosition.Y < 0 and gravity.Y < 0); self.Position, self.Power = newPosition, newPower; -- Start spinning if it's reached max height. if (newPower.Y < 0) then if (self.Size <= 0) then self.Side = 1; imageLabel.ImageColor3 = self.Color; end; if (self.Size >= self.DefaultSize) then self.Side = -1; imageLabel.ImageColor3 = Color3.new(self.Color.r * 0.65, self.Color.g * 0.65, self.Color.b * 0.65); end; self.Size = self.Size + (self.Side * 2); imageLabel.Size = UDim2.new(0, self.DefaultSize, 0, self.Size); end; end; end; -- Stops a confetti from firing again once it's out of bounds. function _Confetti:Toggle() self.Enabled = not(self.Enabled); end; function _Confetti:SetColors(paramColors) colors = paramColors; end; return _Confetti;
-- bg.CFrame = bg.CFrame * CFrame.Angles(0,0,0)
IfOnLand() bv.Velocity = Vector3.new(0,0,0) seat.Anchored = true seat.Velocity = Vector3.new(0,0,0) wait() seat.Anchored = false end end) seat.Changed:connect(function(property) if property == "Occupant" then if seat.Occupant then local p = game.Players:GetPlayerFromCharacter(seat.Occupant.Parent) if p then DriveEnabled = true StartEngine() end else walk:Stop() DriveEnabled = false lastLodged = tick() wait(0.3) Speed = 0 bv.Velocity = Vector3.new(0,0,0) IfOnLand() end end end) local DespawnCoroutine = coroutine.wrap(function() while wait(1) do if tick()-breakTime >= 0 then sp:Destroy() end end end) DespawnCoroutine()
-- Theme UI to current tool
ToolChanged:Connect(function (Tool) coroutine.wrap(RecolorHandle)(Tool.Color); coroutine.wrap(Selection.RecolorOutlines)(Tool.Color); end);
-- humanoidAnimateR15Moods.lua
local Character = script.Parent local Humanoid = Character:WaitForChild("Humanoid") local pose = "Standing" local userNoUpdateOnLoopSuccess, userNoUpdateOnLoopValue = pcall(function() return UserSettings():IsUserFeatureEnabled("UserNoUpdateOnLoop") end) local userNoUpdateOnLoop = userNoUpdateOnLoopSuccess and userNoUpdateOnLoopValue local userAnimateScaleRunSuccess, userAnimateScaleRunValue = pcall(function() return UserSettings():IsUserFeatureEnabled("UserAnimateScaleRun") end) local userAnimateScaleRun = userAnimateScaleRunSuccess and userAnimateScaleRunValue local function getRigScale() if userAnimateScaleRun then return Character:GetScale() else return 1 end end local AnimationSpeedDampeningObject = script:FindFirstChild("ScaleDampeningPercent") local HumanoidHipHeight = 2 local EMOTE_TRANSITION_TIME = 0.1 local currentAnim = "" local currentAnimInstance = nil local currentAnimTrack = nil local currentAnimKeyframeHandler = nil local currentAnimSpeed = 1.0 local runAnimTrack = nil local runAnimKeyframeHandler = nil local PreloadedAnims = {} local animTable = {} local animNames = { idle = { { id = "http://www.roblox.com/asset/?id=507766666", weight = 1 }, { id = "http://www.roblox.com/asset/?id=507766951", weight = 1 }, { id = "http://www.roblox.com/asset/?id=507766388", weight = 9 } }, walk = { { id = "http://www.roblox.com/asset/?id=507777826", weight = 10 } }, run = { { id = "http://www.roblox.com/asset/?id=507767714", weight = 10 } }, swim = { { id = "http://www.roblox.com/asset/?id=507784897", weight = 10 } }, swimidle = { { id = "http://www.roblox.com/asset/?id=507785072", weight = 10 } }, jump = { { id = "http://www.roblox.com/asset/?id=507765000", weight = 10 } }, fall = { { id = "http://www.roblox.com/asset/?id=507767968", weight = 10 } }, climb = { { id = "http://www.roblox.com/asset/?id=507765644", weight = 10 } }, sit = { { id = "http://www.roblox.com/asset/?id=2506281703", weight = 10 } }, toolnone = { { id = "http://www.roblox.com/asset/?id=507768375", weight = 10 } }, toolslash = { { id = "http://www.roblox.com/asset/?id=522635514", weight = 10 } }, toollunge = { { id = "http://www.roblox.com/asset/?id=522638767", weight = 10 } }, wave = { { id = "http://www.roblox.com/asset/?id=507770239", weight = 10 } }, point = { { id = "http://www.roblox.com/asset/?id=507770453", weight = 10 } }, dance = { { id = "http://www.roblox.com/asset/?id=507771019", weight = 10 }, { id = "http://www.roblox.com/asset/?id=507771955", weight = 10 }, { id = "http://www.roblox.com/asset/?id=507772104", weight = 10 } }, dance2 = { { id = "http://www.roblox.com/asset/?id=507776043", weight = 10 }, { id = "http://www.roblox.com/asset/?id=507776720", weight = 10 }, { id = "http://www.roblox.com/asset/?id=507776879", weight = 10 } }, dance3 = { { id = "http://www.roblox.com/asset/?id=507777268", weight = 10 }, { id = "http://www.roblox.com/asset/?id=507777451", weight = 10 }, { id = "http://www.roblox.com/asset/?id=507777623", weight = 10 } }, laugh = { { id = "http://www.roblox.com/asset/?id=507770818", weight = 10 } }, cheer = { { id = "http://www.roblox.com/asset/?id=507770677", weight = 10 } }, }
--// Core
return function(Vargs, GetEnv) local env = GetEnv(nil, {script = script}) setfenv(1, env) local server = Vargs.Server; local service = Vargs.Service; local Functions, Admin, Anti, Core, HTTP, Logs, Remote, Process, Variables, Settings, Deps; local AddLog, Queue, TrackTask local function Init(data) Functions = server.Functions; Admin = server.Admin; Anti = server.Anti; Core = server.Core; HTTP = server.HTTP; Logs = server.Logs; Remote = server.Remote; Process = server.Process; Variables = server.Variables; Settings = server.Settings; Deps = server.Deps; AddLog = Logs.AddLog; Queue = service.Queue; TrackTask = service.TrackTask; --// Core variables Core.Themes = data.Themes or {} Core.Plugins = data.Plugins or {} Core.ModuleID = data.ModuleID or 7510592873 Core.LoaderID = data.LoaderID or 7510622625 Core.DebugMode = data.DebugMode or false Core.Name = server.Functions:GetRandom() Core.LoadstringObj = Core.GetLoadstring() Core.Loadstring = require(Core.LoadstringObj) service.DataStoreService = require(Deps.MockDataStoreService) disableAllGUIs(server.Client.UI); Core.Init = nil; AddLog("Script", "Core Module Initialized") end; local function RunAfterPlugins(data) --// RemoteEvent Handling Core.MakeEvent() --// Prepare the client loader --local existingPlayers = service.Players:GetPlayers(); --Core.MakeClient() local remoteParent = service.ReplicatedStorage; remoteParent.ChildRemoved:Connect(function(c) if server.Core.RemoteEvent and not server.Core.FixingEvent and (function() for i,v in pairs(server.Core.RemoteEvent) do if c == v then return true end end end)() then wait(); server.Core.MakeEvent() end end) --// Load data Core.DataStore = server.Core.GetDataStore() if Core.DataStore then TrackTask("Thread: DSLoadAndHook", function() pcall(server.Core.LoadData) end) end --// Save all data on server shutdown & set GAME_CLOSING game:BindToClose(function() Core.GAME_CLOSING = true; Core.SaveAllPlayerData(); end); --// Start API if service.NetworkServer then --service.Threads.RunTask("_G API Manager",server.Core.StartAPI) TrackTask("Thread: API Manager", Core.StartAPI) end --// Occasionally save all player data to the datastore to prevent data loss if the server abruptly crashes service.StartLoop("SaveAllPlayerData", Core.DS_AllPlayerDataSaveInterval, Core.SaveAllPlayerData, true) Core.RunAfterPlugins = nil; AddLog("Script", "Core Module RunAfterPlugins Finished"); end server.Core = { Init = Init; RunAfterPlugins = RunAfterPlugins; DataQueue = {}; DataCache = {}; PlayerData = {}; CrossServerCommands = {}; CrossServer = function(...) return false end; ExecuteScripts = {}; LastDataSave = 0; FixingEvent = false; ScriptCache = {}; Connections = {}; BytecodeCache = {}; LastEventValue = 1; Variables = { TimeBans = {}; }; --// Datastore update/queue timers/delays DS_WriteQueueDelay = 1; DS_ReadQueueDelay = 0.5; DS_AllPlayerDataSaveInterval = 30; DS_AllPlayerDataSaveQueueDelay = 0.5; --// Used to change/"reset" specific datastore keys DS_RESET_SALTS = { SavedSettings = "32K5j4"; SavedTables = "32K5j4"; }; DS_BLACKLIST = { Trello_Enabled = true; Trello_Primary = true; Trello_Secondary = true; Trello_Token = true; Trello_AppKey = true; DataStore = true; DataStoreKey = true; DataStoreEnabled = true; Creators = true; Permissions = true; G_API = true; G_Access = true; G_Access_Key = true; G_Access_Perms = true; Allowed_API_Calls = true; LoadAdminsFromDS = true; WebPanel_ApiKey = true; WebPanel_Enabled = true; ["Settings.Ranks.Creators.Users"] = true; ["Admin.SpecialLevels"] = true; OnStartup = true; OnSpawn = true; OnJoin = true; CustomRanks = true; Ranks = true; --// Not gonna let malicious stuff set DS_Blacklist to {} or anything! DS_BLACKLIST = true; }; --// Prevent certain keys from loading from the DataStore PlayerDataKeyBlacklist = { AdminRank = true; AdminLevel = true; LastLevelUpdate = true; }; DisconnectEvent = function() if Core.RemoteEvent and not Core.FixingEvent then Core.FixingEvent = true; for name,event in pairs(Core.RemoteEvent.Events) do event:Disconnect() end pcall(function() service.Delete(Core.RemoteEvent.Object) end) pcall(function() service.Delete(Core.RemoteEvent.Function) end) Core.FixingEvent = false; Core.RemoteEvent = nil; end end; MakeEvent = function() local remoteParent = service.ReplicatedStorage; local ran, error = pcall(function() if server.Running then local rTable = {}; local event = service.New("RemoteEvent", {Name = Core.Name, Archivable = false}, true, true) local func = service.New("RemoteFunction", {Name = "__FUNCTION", Parent = event}, true, true) local secureTriggered = true local tripDet = math.random() local function secure(ev, name, parent) return ev.Changed:Connect(function() if Core.RemoteEvent == rTable and not secureTriggered then if ev == func then func.OnServerInvoke = Process.Remote end if ev.Name ~= name then ev.Name = name elseif ev.Parent ~= parent then secureTriggered = true; Core.DisconnectEvent(); Core.MakeEvent() end end end) end Core.DisconnectEvent(); Core.TripDet = tripDet; rTable.Events = {}; rTable.Object = event; rTable.Function = func; rTable.Events.Security = secure(event, event.Name, remoteParent); rTable.Events.FuncSec = secure(func, func.Name, event); func.OnServerInvoke = Process.Remote; rTable.Events.ProcessEvent = service.RbxEvent(event.OnServerEvent, Process.Remote); Core.RemoteEvent = rTable; event.Parent = remoteParent; secureTriggered = false; AddLog(Logs.Script,{ Text = "Created RemoteEvent"; Desc = "RemoteEvent was successfully created"; }) end end) if error then warn(error) end end; UpdateConnections = function() if service.NetworkServer then for i,cli in ipairs(service.NetworkServer:GetChildren()) do if cli:IsA("NetworkReplicator") then Core.Connections[cli] = cli:GetPlayer() end end end end; UpdateConnection = function(p) if service.NetworkServer then for i,cli in ipairs(service.NetworkServer:GetChildren()) do if cli:IsA("NetworkReplicator") and cli:GetPlayer() == p then Core.Connections[cli] = p end end end end; GetNetworkClient = function(p) if service.NetworkServer then for i,cli in ipairs(service.NetworkServer:GetChildren()) do if cli:IsA("NetworkReplicator") and cli:GetPlayer() == p then return cli end end end end; MakeClient = function(parent) if not parent and Core.ClientLoader then local loader = Core.ClientLoader; loader.Removing = true; for i,v in pairs(loader.Events) do v:Disconnect() end loader.Object:Destroy(); end; local depsName = Functions:GetRandom() local folder = server.Client:Clone() local acli = server.Deps.ClientMover:Clone(); local client = folder.Client local parentObj = parent or service.StarterPlayer:FindFirstChildOfClass("StarterPlayerScripts"); local clientLoader = { Removing = false; }; Core.MockClientKeys = Core.MockClientKeys or { Special = depsName; Module = client; } local depsName = Core.MockClientKeys.Special; local specialVal = service.New("StringValue") specialVal.Value = Core.Name.."\\"..depsName specialVal.Name = "Special" specialVal.Parent = folder acli.Parent = folder; acli.Disabled = false; folder.Archivable = false; folder.Name = depsName; --"Adonis_Client" folder.Parent = parentObj; if not parent then local oName = folder.Name; clientLoader.Object = folder; clientLoader.Events = {} clientLoader.Events[folder] = folder.Changed:Connect(function() if Core.ClientLoader == clientLoader and not clientLoader.Removing then if folder.Name ~= oName then folder.Name = oName; elseif folder.Parent ~= parentObj then clientLoader.Removing = true; Core.MakeClient(); end end end) local function sec(child) local oParent = child.Parent; local oName = child.Name; clientLoader.Events[child.Changed] = child.Changed:Connect(function(c) if Core.ClientLoader == clientLoader and not clientLoader.Removing then if child.Parent ~= oParent or child == specialVal then Core.MakeClient(); end end end) local nameEvent = child:GetPropertyChangedSignal("Name"):Connect(function() if Core.ClientLoader == clientLoader and not clientLoader.Removing then child.Name = oName; end end) clientLoader.Events[nameEvent] = nameEvent; clientLoader.Events[child.AncestryChanged] = child.AncestryChanged:Connect(function() if Core.ClientLoader == clientLoader and not clientLoader.Removing then Core.MakeClient(); end end) end; for i,child in ipairs(folder:GetDescendants()) do sec(child); end folder.DescendantAdded:Connect(function(d) if Core.ClientLoader == clientLoader and not clientLoader.Removing then Core.MakeClient(); end end) folder.DescendantRemoving:Connect(function(d) if Core.ClientLoader == clientLoader and not clientLoader.Removing then Core.MakeClient(); end end) Core.ClientLoader = clientLoader; end local ok,err = pcall(function() folder.Parent = parentObj end) clientLoader.Removing = false; AddLog("Script", "Created client"); end; HookClient = function(p) local key = tostring(p.UserId) local keys = Remote.Clients[key] if keys then local depsName = Functions:GetRandom() local eventName = Functions:GetRandom() local folder = server.Client:Clone() local acli = server.Deps.ClientMover:Clone(); local client = folder.Client local parentTo = "PlayerGui" --// Roblox, seriously, please give the server access to PlayerScripts already so I don't need to do this. local parentObj = p:FindFirstChildOfClass(parentTo) or p:WaitForChild(parentTo, 600); if not p.Parent then return false elseif not parentObj then p:Kick("\n[CLI-102495] Loading Error \nPlayerGui Missing (Waited 10 Minutes)") return false end local container = service.New("ScreenGui"); container.ResetOnSpawn = false; container.Enabled = false; container.Name = "\0"; local specialVal = service.New("StringValue") specialVal.Value = Core.Name.."\\"..depsName specialVal.Name = "Special" specialVal.Parent = folder keys.Special = depsName keys.EventName = eventName keys.Module = client acli.Parent = folder; acli.Disabled = false; folder.Name = "Adonis_Client" folder.Parent = container; --// Event only fires AFTER the client is alive and well local event; event = service.Events.ClientLoaded:Connect(function(plr) if p == plr and container.Parent == parentObj then container.Parent = nil --container:Destroy(); -- Destroy update causes an issue with this pretty sure p.AncestryChanged:Connect(function() -- after/on remove, not on removing... if p.Parent == nil then pcall(function() container:Destroy() end) -- Prevent potential memory leak and ensure this gets properly murdered when they leave and it's no longer needed end end) event:Disconnect(); end end) local ok,err = pcall(function() container.Parent = parentObj end) if not ok then p:Kick("\n[CLI-192385] Loading Error \n[HookClient Error: "..tostring(err).."]") return false else return true end else if p and p.Parent then p:Kick("\n[CLI-5691283] Loading Error \n[HookClient: Keys Missing]") end end end; LoadClientLoader = function(p) local loader = Deps.ClientLoader:Clone() loader.Name = Functions.GetRandom() loader.Parent = p:WaitForChild("PlayerGui", 60) or p:WaitForChild("Backpack") loader.Disabled = false end; LoadExistingPlayer = function(p) warn("Loading existing player: ".. tostring(p)) TrackTask("Thread: Setup Existing Player: ".. tostring(p), function() Process.PlayerAdded(p) --Core.MakeClient(p:FindFirstChildOfClass("PlayerGui") or p:WaitForChild("PlayerGui", 120)) end) end; ExecutePermission = function(scr, code, isLocal) local fixscr = service.UnWrap(scr) for _, val in pairs(Core.ExecuteScripts) do if not isLocal or (isLocal and val.Type == "LocalScript") then if (service.UnWrap(val.Script) == fixscr or code == val.Code) and (not val.runLimit or (val.runLimit ~= nil and val.Executions <= val.runLimit)) then val.Executions = val.Executions+1 return { Source = val.Source; noCache = val.noCache; runLimit = val.runLimit; Executions = val.Executions; } end end end end; GetScript = function(scr,code) for i,val in pairs(Core.ExecuteScripts) do if val.Script == scr or code == val.Code then return val,i end end end; UnRegisterScript = function(scr) for i,dat in pairs(Core.ExecuteScripts) do if dat.Script == scr or dat == scr then table.remove(Core.ExecuteScripts, i) return dat end end end; RegisterScript = function(data) data.Executions = 0 data.Time = os.time() data.Type = data.Script.ClassName data.Wrapped = service.Wrap(data.Script) data.Wrapped:SetSpecial("Clone",function() return Core.RegisterScript { Script = service.UnWrap(data.Script):Clone(); Code = data.Code; Source = data.Source; noCache = data.noCache; runLimit = data.runLimit; } end) for ind,scr in pairs(Core.ExecuteScripts) do if scr.Script == data.Script then return scr.Wrapped or scr.Script end end if not data.Code then data.Code = Functions.GetRandom() end table.insert(Core.ExecuteScripts,data) return data.Wrapped end; GetLoadstring = function() local newLoad = Deps.Loadstring:Clone(); local lbi = server.Shared.FiOne:Clone(); lbi.Parent = newLoad return newLoad; end; Bytecode = function(str) if Core.BytecodeCache[str] then return Core.BytecodeCache[str] end local f, buff = Core.Loadstring(str) Core.BytecodeCache[str] = buff return buff end; NewScript = function(type,source,allowCodes,noCache,runLimit) local ScriptType local execCode = Functions.GetRandom() if type == 'Script' then ScriptType = Deps.ScriptBase:Clone() elseif type == 'LocalScript' then ScriptType = Deps.LocalScriptBase:Clone() end if ScriptType then ScriptType.Name = "[Adonis] ".. type if allowCodes then service.New("StringValue", { Name = "Execute", Value = execCode, Parent = ScriptType, }) end local wrapped = Core.RegisterScript { Script = ScriptType; Code = execCode; Source = Core.Bytecode(source); noCache = noCache; runLimit = runLimit; } return wrapped or ScriptType, ScriptType, execCode end end; SavePlayer = function(p,data) local key = tostring(p.UserId) Core.PlayerData[key] = data end; DefaultPlayerData = function(p) return { Donor = { Cape = { Image = '0'; Color = 'White'; Material = 'Neon'; }; Enabled = false; }; Banned = false; TimeBan = false; AdminNotes = {}; Keybinds = {}; Aliases = {}; Client = {}; Warnings = {}; AdminPoints = 0; }; end; GetPlayer = function(p) local key = tostring(p.UserId) if not Core.PlayerData[key] then local PlayerData = Core.DefaultPlayerData(p) Core.PlayerData[key] = PlayerData if Core.DataStore then local data = Core.GetData(key) if data and type(data) == "table" then data.AdminNotes = (data.AdminNotes and Functions.DSKeyNormalize(data.AdminNotes, true)) or {} data.Warnings = (data.Warnings and Functions.DSKeyNormalize(data.Warnings, true)) or {} local BLOCKED_SETTINGS = server.Core.PlayerDataKeyBlacklist for i,v in pairs(data) do if not BLOCKED_SETTINGS[i] then PlayerData[i] = v end end end end return PlayerData else return Core.PlayerData[key] end end; ClearPlayer = function(p) Core.PlayerData[tostring(p.UserId)] = Core.DefaultData(p); end; SavePlayerData = function(p, customData) local key = tostring(p.UserId); local pData = customData or Core.PlayerData[key]; if Core.DataStore then if pData then local data = service.CloneTable(pData); data.LastChat = nil data.AdminRank = nil data.AdminLevel = nil data.LastLevelUpdate = nil data.LastDataSave = nil data.AdminNotes = Functions.DSKeyNormalize(data.AdminNotes) data.Warnings = Functions.DSKeyNormalize(data.Warnings) Core.SetData(key, data) AddLog(Logs.Script,{ Text = "Saved data for ".. p.Name; Desc = "Player data was saved to the datastore"; }) pData.LastDataSave = os.time(); end end end; SaveAllPlayerData = function(queueWaitTime) local TrackTask = service.TrackTask for key,pdata in pairs(Core.PlayerData) do local id = tonumber(key); local player = id and service.Players:GetPlayerByUserId(id); if player and (not pdata.LastDataSave or os.time() - pdata.LastDataSave >= Core.DS_AllPlayerDataSaveInterval) then TrackTask(string.format("Save data for %s", player.Name), Core.SavePlayerData, player); end end --[[ --// OLD METHOD (Kept in case this messes anything up) for i,p in next,service.Players:GetPlayers() do local pdata = Core.PlayerData[tostring(p.UserId)]; --// Only save player's data if it has not been saved within the last INTERVAL (default 30s) if pdata and (not pdata.LastDataSave or os.time() - pdata.LastDataSave >= Core.DS_AllPlayerDataSaveInterval) then service.Queue("SavePlayerData", function() Core.SavePlayerData(p) wait(queueWaitTime or Core.DS_AllPlayerDataSaveQueueDelay) end) end end--]] end; GetDataStore = function() local ran,store = pcall(function() return service.DataStoreService:GetDataStore(string.sub(Settings.DataStore, 1, 50),"Adonis") end) -- DataStore studio check. if ran and store and service.RunService:IsStudio() then local success, res = pcall(store.GetAsync, store, math.random()) if not success and string.find(res, "502", 1, true) then warn("Unable to load data because Studio access to API services is disabled.") return; end end return ran and store end; DataStoreEncode = function(key) if Core.DS_RESET_SALTS[key] then key = Core.DS_RESET_SALTS[key] .. key end return Functions.Base64Encode(Remote.Encrypt(tostring(key), Settings.DataStoreKey)) end; SaveData = function(...) return Core.SetData(...) end; DS_GetRequestDelay = function(type) local requestType, budget; local reqPerMin = 60 + #service.Players:GetPlayers() * 10; local reqDelay = 60 / reqPerMin; if type == "Write" then requestType = Enum.DataStoreRequestType.SetIncrementAsync; elseif type == "Read" then requestType = Enum.DataStoreRequestType.GetAsync; elseif type == "Update" then requestType = Enum.DataStoreRequestType.UpdateAsync; end repeat budget = service.DataStoreService:GetRequestBudgetForRequestType(requestType); until budget > 0 and task.wait(1) return reqDelay + 0.5; end; DS_WriteLimiter = function(type, func, ...) local vararg = table.pack(...) return Queue("DataStoreWriteData_" .. tostring(type), function() local gotDelay = Core.DS_GetRequestDelay(type); --// Wait for budget, also return how long we should wait before the next request is allowed to go func(unpack(vararg, 1, vararg.n)) task.wait(gotDelay) end, 120, true) end; RemoveData = function(key) local DataStore = Core.DataStore if DataStore then local ran2, err2 = Queue("DataStoreWriteData" .. tostring(key), function() local ran, ret = Core.DS_WriteLimiter("Write", DataStore.RemoveAsync, DataStore, Core.DataStoreEncode(key)) if ran then Core.DataCache[key] = nil else logError("DataStore RemoveAsync Failed: ".. tostring(ret)) end task.wait(6) end, 120, true) if not ran2 then warn("DataStore RemoveData Failed: ".. tostring(err2)) end end end; SetData = function(key, value, repeatCount) if repeatCount then warn("Retrying SetData request for ".. key); end local DataStore = Core.DataStore if DataStore then if value == nil then return Core.RemoveData(key) else local ran2, err2 = Queue("DataStoreWriteData" .. tostring(key), function() local ran, ret = Core.DS_WriteLimiter("Write", DataStore.SetAsync, DataStore, Core.DataStoreEncode(key), value) if ran then Core.DataCache[key] = value else logError("DataStore SetAsync Failed: ".. tostring(ret)); end task.wait(6) end, 120, true) if not ran2 then logError("DataStore SetData Failed: ".. tostring(err2)) --// Attempt 3 times, with slight delay between if failed task.wait(1); if not repeatCount then return Core.SetData(key, value, 3); elseif repeatCount > 0 then return Core.SetData(key, value, repeatCount - 1); end end end end end; UpdateData = function(key, func, repeatCount) if repeatCount then warn("Retrying UpdateData request for ".. key); end local DataStore = Core.DataStore if DataStore then local err = false; local ran2, err2 = Queue("DataStoreWriteData" .. tostring(key), function() local ran, ret = Core.DS_WriteLimiter("Update", DataStore.UpdateAsync, DataStore, Core.DataStoreEncode(key), func) if not ran then err = ret; logError("DataStore UpdateAsync Failed: ".. tostring(ret)) return error(ret); end wait(6) end, 120, true) --// 120 timeout, yield until this queued function runs and completes if not ran2 then logError("DataStore UpdateData Failed: ".. tostring(err2)) --// Attempt 3 times, with slight delay between if failed wait(1); if not repeatCount then return Core.UpdateData(key, func, 3); elseif repeatCount > 0 then return Core.UpdateData(key, func, repeatCount - 1); end end return err end end; GetData = function(key, repeatCount) if repeatCount then warn("Retrying GetData request for ".. key); end local DataStore = Core.DataStore if DataStore then local ran2, err2 = Queue("DataStoreReadData", function() local ran, ret = pcall(DataStore.GetAsync, DataStore, Core.DataStoreEncode(key)) if ran then Core.DataCache[key] = ret return ret else logError("DataStore GetAsync Failed: ".. tostring(ret)) if Core.DataCache[key] then return Core.DataCache[key]; else error(ret); end end wait(Core.DS_GetRequestDelay("Read")) end, 120, true) if not ran2 then logError("DataStore GetData Failed: ".. tostring(err2)) --// Attempt 3 times, with slight delay between if failed wait(1); if not repeatCount then return Core.GetData(key, 3); elseif repeatCount > 0 then return Core.GetData(key, repeatCount - 1); end else return err2; end end end; IndexPathToTable = function(tableAncestry) local Blacklist = Core.DS_BLACKLIST if type(tableAncestry) == "string" and not Blacklist[tableAncestry] then return server.Settings[tableAncestry], tableAncestry elseif type(tableAncestry) == "table" then local curTable = server local curName = "Server" for _, ind in ipairs(tableAncestry) do curTable = curTable[ind] curName = ind if curName and type(curName) == "string" then --// Admins do NOT load from the DataStore with this setting if curName == "Ranks" and Settings.LoadAdminsFromDS == false then return nil end end if not curTable then --warn(tostring(ind) .." could not be found"); --// Not allowed or table is not found return nil end end if curName and type(curName) == "string" and Blacklist[curName] then return nil end return curTable, curName end return nil end; ClearAllData = function() local tabs = Core.GetData("SavedTables") or {}; for _, v in pairs(tabs) do if v.TableKey then Core.RemoveData(v.TableKey); end end Core.SetData("SavedSettings",{}); Core.SetData("SavedTables",{}); Core.CrossServer("LoadData"); end; GetTableKey = function(indList) local tabs = Core.GetData("SavedTables") or {}; local realTable,tableName = Core.IndexPathToTable(indList); local foundTable = nil; for i,v in pairs(tabs) do if type(v) == "table" and v.TableName and v.TableName == tableName then foundTable = v break; end end if not foundTable then foundTable = { TableName = tableName; TableKey = "SAVEDTABLE_".. tableName; } table.insert(tabs, foundTable); Core.SetData("SavedTables", tabs); end if not Core.GetData(foundTable.TableKey) then Core.SetData(foundTable.TableKey, {}); end return foundTable.TableKey; end; DoSave = function(data) local type = data.Type if type == "ClearSettings" then Core.ClearAllData(); elseif type == "SetSetting" then local setting = data.Setting local value = data.Value Core.UpdateData("SavedSettings", function(settings) settings[setting] = value return settings end) Core.CrossServer("LoadData", "SavedSettings", {[setting] = value}); elseif type == "TableRemove" then local key = Core.GetTableKey(data.Table); local tab = data.Table local value = data.Value data.Action = "Remove" data.Time = os.time() local CheckMatch = Functions.CheckMatch Core.UpdateData(key, function(sets) sets = sets or {} for i,v in pairs(sets) do if CheckMatch(tab, v.Table) and CheckMatch(v.Value, value) then table.remove(sets,i) end end --// Check that the real table actually has the item to remove, do not create if it does not have it --// Prevents snowballing local indList = tab local continueOperation = false if indList[1] == "Settings" then local indClone = table.clone(indList) indClone[1] = "OriginalSettings" local realTable,tableName = Core.IndexPathToTable(indClone) for i,v in pairs(realTable) do if CheckMatch(v, value) then continueOperation = true end end else continueOperation = true end if continueOperation then table.insert(sets, data) end return sets end) Core.CrossServer("LoadData", "TableUpdate", data); elseif type == "TableAdd" then local key = Core.GetTableKey(data.Table); local tab = data.Table local value = data.Value data.Action = "Add" data.Time = os.time() local CheckMatch = Functions.CheckMatch Core.UpdateData(key, function(sets) sets = sets or {} for i,v in pairs(sets) do if CheckMatch(tab, v.Table) and CheckMatch(v.Value, value) then table.remove(sets, i) end end --// Check that the real table does not have the item to add, do not create if it has it --// Prevents snowballing local indList = tab local continueOperation = true if indList[1] == "Settings" then local indClone = table.clone(indList) indClone[1] = "OriginalSettings" local realTable,tableName = Core.IndexPathToTable(indClone) for i,v in pairs(realTable) do if CheckMatch(v, value) then continueOperation = false end end end if continueOperation then table.insert(sets, data) end return sets end) Core.CrossServer("LoadData", "TableUpdate", data); end AddLog(Logs.Script,{ Text = "Saved setting change to datastore"; Desc = "A setting change was issued and saved"; }) end; LoadData = function(key, data, serverId) if serverId and serverId == game.JobId then return end; local Blacklist = Core.DS_BLACKLIST local CheckMatch = Functions.CheckMatch; if key == "TableUpdate" then local tab = data; local indList = tab.Table; local nameRankComp = {--// Old settings backwards compatability Owners = {"Settings", "Ranks", "HeadAdmins", "Users"}; Creators = {"Settings", "Ranks", "Creators", "Users"}; HeadAdmins = {"Settings", "Ranks", "HeadAdmins", "Users"}; Admins = {"Settings", "Ranks", "Admins", "Users"}; Moderators = {"Settings", "Ranks", "Moderators", "Users"}; } if type(indList) == "string" and nameRankComp[indList] then indList = nameRankComp[indList]; end local realTable, tableName = Core.IndexPathToTable(indList); local displayName = type(indList) == "table" and table.concat(indList, ".") or tableName; if displayName and type(displayName) == "string" then if Blacklist[displayName] then return end if type(indList) == "table" and indList[1] == "Settings" and indList[2] == "Ranks" then if not Settings.SaveAdmins and not Core.WarnedAboutAdminsLoadingWhenSaveAdminsIsOff and not Settings.SaveAdminsWarning and Settings.LoadAdminsFromDS then warn("Admins are loading from the Adonis DataStore when Settings.SaveAdmins is FALSE!\nDisable this warning by adding the setting \"SaveAdminsWarning\" in Settings (and set it to true!) or set Settings.LoadAdminsFromDS to false") Core.WarnedAboutAdminsLoadingWhenSaveAdminsIsOff = true end end end if realTable and tab.Action == "Add" then for i,v in pairs(realTable) do if CheckMatch(v, tab.Value) then table.remove(realTable, i) end end AddLog("Script", { Text = "Added value to ".. displayName; Desc = "Added "..tostring(tab.Value).." to ".. displayName .." from datastore"; }) table.insert(realTable, tab.Value) elseif realTable and tab.Action == "Remove" then for i,v in pairs(realTable) do if CheckMatch(v, tab.Value) then AddLog("Script",{ Text = "Removed value from ".. displayName; Desc = "Removed "..tostring(tab.Value).." from ".. displayName .." from datastore"; }) table.remove(realTable, i) end end end else local SavedSettings local SavedTables if Core.DataStore and Settings.DataStoreEnabled then if Settings.DataStoreKey == server.Defaults.Settings.DataStoreKey then table.insert(server.Messages, { Title = "Warning!"; Message = "Using default datastore key!"; Icon = server.MatIcons.Description; Time = 15; OnClick = server.Core.Bytecode([[ local window = client.UI.Make("Window", { Title = "How to change the DataStore key"; Size = {700,300}; Icon = "rbxassetid://7510994359"; }) window:Add("ImageLabel", { Image = "rbxassetid://1059543904"; }) window:Ready() ]]); }) end local GetData, LoadData, SaveData, DoSave = Core.GetData, Core.LoadData, Core.SaveData, Core.DoSave if not key then SavedSettings = GetData("SavedSettings") SavedTables = GetData("SavedTables") elseif key and not data then if key == "SavedSettings" then SavedSettings = GetData("SavedSettings") elseif key == "SavedTables" then SavedTables = GetData("SavedTables") end elseif key and data then if key == "SavedSettings" then SavedSettings = data elseif key == "SavedTables" then SavedTables = data end end if not key and not data then if not SavedSettings then SavedSettings = {} SaveData("SavedSettings", {}) end if not SavedTables then SavedTables = {} SaveData("SavedTables", {}) end end if SavedSettings then for setting,value in pairs(SavedSettings) do if not Blacklist[setting] then if setting == 'Prefix' or setting == 'AnyPrefix' or setting == 'SpecialPrefix' then local orig = Settings[setting] for i,v in pairs(server.Commands) do if v.Prefix == orig then v.Prefix = value end end end Settings[setting] = value end end end if SavedTables then for i,tData in pairs(SavedTables) do if tData.TableName and tData.TableKey and not Blacklist[tData.tableName] then local data = GetData(tData.TableKey); if data then for k,v in ipairs(data) do LoadData("TableUpdate", v) end end elseif tData.Table and tData.Action then LoadData("TableUpdate", tData) end end if Core.Variables.TimeBans then for i,v in pairs(Core.Variables.TimeBans) do if v.EndTime-os.time() <= 0 then table.remove(Core.Variables.TimeBans, i) DoSave({ Type = "TableRemove"; Table = {"Core", "Variables", "TimeBans"}; Value = v; }) end end end end AddLog(Logs.Script,{ Text = "Loaded saved data"; Desc = "Data was retrieved from the datastore and loaded successfully"; }) end end end; StartAPI = function() local _G = _G local setmetatable = setmetatable local rawset = rawset local rawget = rawget local type = type local error = error local print = print local warn = warn local pairs = pairs local next = next local table = table local getfenv = getfenv local setfenv = setfenv local require = require local tostring = tostring local server = server local service = service local Routine = Routine local cPcall = cPcall local MetaFunc = service.MetaFunc local StartLoop = service.StartLoop local API_Special = { AddAdmin = Settings.Allowed_API_Calls.DataStore; RemoveAdmin = Settings.Allowed_API_Calls.DataStore; RunCommand = Settings.Allowed_API_Calls.Core; SaveTableAdd = Settings.Allowed_API_Calls.DataStore and Settings.Allowed_API_Calls.Settings; SaveTableRemove = Settings.Allowed_API_Calls.DataStore and Settings.Allowed_API_Calls.Settings; SaveSetSetting = Settings.Allowed_API_Calls.DataStore and Settings.Allowed_API_Calls.Settings; ClearSavedSettings = Settings.Allowed_API_Calls.DataStore and Settings.Allowed_API_Calls.Settings; SetSetting = Settings.Allowed_API_Calls.Settings; } setfenv(1,setmetatable({}, {__metatable = getmetatable(getfenv())})) local API_Specific = { API_Specific = { Test = function() print("We ran the api specific stuff") end }; Settings = Settings; Service = service; } local API = { Access = MetaFunc(function(...) local args = {...} local key = args[1] local ind = args[2] local targ if API_Specific[ind] then targ = API_Specific[ind] elseif server[ind] and Settings.Allowed_API_Calls[ind] then targ = server[ind] end if Settings.G_Access and key == Settings.G_Access_Key and targ and Settings.Allowed_API_Calls[ind] == true then if type(targ) == "table" then return service.NewProxy { __index = function(tab,inde) if targ[inde] ~= nil and API_Special[inde] == nil or API_Special[inde] == true then AddLog(Logs.Script,{ Text = "Access to "..tostring(inde).." was granted"; Desc = "A server script was granted access to "..tostring(inde); }) if targ[inde]~=nil and type(targ[inde]) == "table" and Settings.G_Access_Perms == "Read" then return service.ReadOnly(targ[inde]) else return targ[inde] end elseif API_Special[inde] == false then AddLog(Logs.Script,{ Text = "Access to "..tostring(inde).." was denied"; Desc = "A server script attempted to access "..tostring(inde).." via _G.Adonis.Access"; }) error("Access Denied: "..tostring(inde)) else error("Could not find "..tostring(inde)) end end; __newindex = function(tabl,inde,valu) if Settings.G_Access_Perms == "Read" then error("Read-only") elseif Settings.G_Access_Perms == "Write" then tabl[inde] = valu end end; __metatable = true; } end else error("Incorrect key or G_Access is disabled") end end); Scripts = service.ReadOnly({ ExecutePermission = MetaFunc(function(srcScript, code) local exists; for i,v in pairs(Core.ScriptCache) do if v.Script == srcScript then exists = v end end if exists and exists.noCache ~= true and (not exists.runLimit or (exists.runLimit and exists.Executions <= exists.runLimit)) then exists.Executions = exists.Executions+1 return exists.Source, exists.Loadstring end local data = Core.ExecutePermission(srcScript, code) if data and data.Source then local module; if not exists then module = require(server.Shared.FiOne:Clone()) table.insert(Core.ScriptCache,{ Script = srcScript; Source = data.Source; Loadstring = module; noCache = data.noCache; runLimit = data.runLimit; Executions = data.Executions; }) else module = exists.Loadstring exists.Source = data.Source end return data.Source, module end end); }, nil, nil, true); CheckAdmin = MetaFunc(Admin.CheckAdmin); IsAdmin = MetaFunc(Admin.CheckAdmin); IsBanned = MetaFunc(Admin.CheckBan); IsMuted = MetaFunc(Admin.IsMuted); CheckDonor = MetaFunc(Admin.CheckDonor); GetLevel = MetaFunc(Admin.GetLevel); SetLighting = MetaFunc(Functions.SetLighting); SetPlayerLighting = MetaFunc(Remote.SetLighting); NewParticle = MetaFunc(Functions.NewParticle); RemoveParticle = MetaFunc(Functions.RemoveParticle); NewLocal = MetaFunc(Remote.NewLocal); MakeLocal = MetaFunc(Remote.MakeLocal); MoveLocal = MetaFunc(Remote.MoveLocal); RemoveLocal = MetaFunc(Remote.RemoveLocal); Hint = MetaFunc(Functions.Hint); Message = MetaFunc(Functions.Message); RunCommandAsNonAdmin = MetaFunc(Admin.RunCommandAsNonAdmin); } local AdonisGTable = service.NewProxy({ __index = function(tab,ind) if Settings.G_API then return API[ind] elseif ind == "Scripts" then return API.Scripts else error("_G API is disabled") end end; __newindex = function() error("Read-only") end; __metatable = true; }) if not rawget(_G, "Adonis") then if table.isfrozen and not table.isfrozen(_G) or not table.isfrozen then rawset(_G, "Adonis", AdonisGTable) StartLoop("APICheck", 1, function() if rawget(_G, "Adonis") ~= AdonisGTable then if table.isfrozen and not table.isfrozen(_G) or not table.isfrozen then rawset(_G, "Adonis", AdonisGTable) else warn("ADONIS CRITICAL WARNING! MALICIOUS CODE IS TRYING TO CHANGE THE ADONIS _G API AND IT CAN'T BE SET BACK! PLEASE SHUTDOWN THE SERVER AND REMOVE THE MALICIOUS CODE IF POSSIBLE!") end end end, true) else warn("The _G table was locked and the Adonis _G API could not be loaded") end end AddLog(Logs.Script,{ Text = "Started _G API"; Desc = "_G API was initialized and is ready to use"; }) end; }; end
--Engine
function Engine() --Neutral Gear if _CGear==0 then _ClutchOn = false end --Car is off local revMin = _Tune.IdleRPM if not _IsOn then revMin = 0 _CGear = 0 _ClutchOn = false _GThrot = _Tune.IdleThrottle end --Determine RPM local maxSpin=0 for i,v in pairs(Drive) do if v.RotVelocity.Magnitude>maxSpin then maxSpin = v.RotVelocity.Magnitude end end if _ClutchOn then local aRPM = math.max(math.min(maxSpin*_Tune.Ratios[_CGear+2]*_Tune.FinalDrive*30/math.pi,_Tune.Redline+100),revMin) local clutchP = math.min(math.abs(aRPM-_RPM)/_Tune.ClutchTol,.9) _RPM = ( (_RPM*2*clutchP) + (aRPM*2*(1-clutchP)) )/2 _HP = (_Tune.Horsepower/2) * math.sin((math.pi/((1+(math.min(10,_Tune.IdleOffset)/100))*_Tune.PeakRPM)) * (_RPM - (((2-(1+(math.min(10,_Tune.IdleOffset)/100)))* _Tune.PeakRPM)/2))) + (_Tune.Horsepower/2) _OutTorque = _HP * 5250 / _RPM * _Tune.Ratios[_CGear+2] * _Tune.FinalDrive else if _GThrot-_Tune.IdleThrottle>0 then _RPM = math.min(_RPM+_Tune.RevAccel*_GThrot,_Tune.Redline+100) else _RPM = math.max(_RPM-_Tune.RevDecay,revMin) end _OutTorque = 0 end --Rev Limiter local spLimit = 0 if _RPM>_Tune.Redline then if _CGear<#_Tune.Ratios-2 then _RPM = _RPM-_Tune.RevBounce spLimit = 0 else _RPM = _RPM-_Tune.RevBounce*.5 end else spLimit = (_Tune.Redline+100)*math.pi/(30*_Tune.Ratios[_CGear+2]*_Tune.FinalDrive) end --Automatic Transmission if _TMode == "Auto" and _IsOn then _ClutchOn = true if _CGear == 0 then _CGear = 1 end if _CGear >= 1 then if _CGear==1 and _GBrake > 0 and car.DriveSeat.Velocity.Magnitude < 20 then _CGear = -1 else if _Tune.AutoShiftMode == "RPM" then if _RPM>(_Tune.PeakRPM+_Tune.AutoUpThresh) then _CGear=math.min(_CGear+1,#_Tune.Ratios-2) elseif math.max(math.min(maxSpin*_Tune.Ratios[_CGear+1]*_Tune.FinalDrive*30/math.pi,_Tune.Redline+100),_Tune.IdleRPM)<(_Tune.PeakRPM-_Tune.AutoDownThresh) then _CGear=math.max(_CGear-1,1) end else if car.DriveSeat.Velocity.Magnitude > math.ceil(wDia*math.pi*(_Tune.PeakRPM+_Tune.AutoUpThresh)/60/_Tune.Ratios[_CGear+2]/_Tune.FinalDrive) then _CGear=math.min(_CGear+1,#_Tune.Ratios-2) elseif car.DriveSeat.Velocity.Magnitude < math.ceil(wDia*math.pi*(_Tune.PeakRPM-_Tune.AutoDownThresh)/60/_Tune.Ratios[_CGear+1]/_Tune.FinalDrive) then _CGear=math.max(_CGear-1,1) end end end else if _GThrot-_Tune.IdleThrottle > 0 and car.DriveSeat.Velocity.Magnitude < 20 then _CGear = 1 end end end --Differential Stuff local fwspeed=0 local fwcount=0 local rwspeed=0 local rwcount=0 for i,v in pairs(car.Wheels:GetChildren()) do if v.Name=="FL" or v.Name=="FR" or v.Name == "F" then fwspeed=fwspeed+v.RotVelocity.Magnitude fwcount=fwcount+1 elseif v.Name=="RL" or v.Name=="RR" or v.Name == "R" then rwspeed=rwspeed+v.RotVelocity.Magnitude rwcount=rwcount+1 end end fwspeed=fwspeed/fwcount rwspeed=rwspeed/rwcount local cwspeed=(fwspeed+rwspeed)/2 --Apply Forces for i,v in pairs(car.Wheels:GetChildren()) do local Ref=v.Axle.CFrame.lookVector local aRef=1 local diffMult=1 if v.Name=="FL" or v.Name=="RL" then aRef=-1 end --Torque Compensation if _Tune.Config ~= "AWD" then _OutTorque = _OutTorque*1.3 end --Differential if v.Name=="FL" or v.Name=="FR" then diffMult=math.max(0,math.min(1,1+((((v.RotVelocity.Magnitude-fwspeed)/fwspeed)/(math.max(_Tune.FDiffSlipThres,1)/100))*((_Tune.FDiffLockThres-50)/50)))) if _Tune.Config == "AWD" then diffMult=math.max(0,math.min(1,diffMult*(1+((((fwspeed-cwspeed)/cwspeed)/(math.max(_Tune.CDiffSlipThres,1)/100))*((_Tune.CDiffLockThres-50)/50))))) end elseif v.Name=="RL" or v.Name=="RR" then diffMult=math.max(0,math.min(1,1+((((v.RotVelocity.Magnitude-rwspeed)/rwspeed)/(math.max(_Tune.RDiffSlipThres,1)/100))*((_Tune.RDiffLockThres-50)/50)))) if _Tune.Config == "AWD" then diffMult=math.max(0,math.min(1,diffMult*(1+((((rwspeed-cwspeed)/cwspeed)/(math.max(_Tune.CDiffSlipThres,1)/100))*((_Tune.CDiffLockThres-50)/50))))) end end --Output if _PBrake and ((_Tune.Config ~= "FWD" and (((v.Name=="FL" or v.Name=="FR") and car.DriveSeat.Velocity.Magnitude<20) or ((v.Name=="RR" or v.Name=="RL") and car.DriveSeat.Velocity.Magnitude>=20))) or (_Tune.Config == "FWD" and (v.Name=="RR" or v.Name=="RL"))) then v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*_Tune.PBrakeForce v["#AV"].angularvelocity=Vector3.new() else if ((_TMode == "Manual" or _TMode == "Semi") and _GBrake==0) or (_TMode == "Auto" and ((_CGear>-1 and _GBrake==0 ) or (_CGear==-1 and _GThrot-_Tune.IdleThrottle==0 )))then local driven = false for _,a in pairs(Drive) do if a==v then driven = true end end if driven then local on=1 if not script.Parent.IsOn.Value then on=0 end local throt = _GThrot if _TMode == "Auto" and _CGear==-1 then throt = _GBrake end local tqTCS = 1 if _TCS then tqTCS = 1-(math.min(math.max(0,math.abs(v.RotVelocity.Magnitude*(v.Size.x/2) - v.Velocity.Magnitude)-_Tune.TCSThreshold)/_Tune.TCSGradient,1)*(1-_Tune.TCSLimit)) end if tqTCS < 1 then _TCSActive = true else _TCSActive = false end local dir = 1 if _CGear==-1 then dir = -1 end v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*_OutTorque*(1+(v.RotVelocity.Magnitude/60)^1.15)*throt*tqTCS*diffMult*on v["#AV"].angularvelocity=Ref*aRef*spLimit*dir else v["#AV"].maxTorque=Vector3.new() v["#AV"].angularvelocity=Vector3.new() end else local brake = _GBrake if _TMode == "Auto" and _CGear==-1 then brake = _GThrot end v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*_Tune.BrakeForce*brake v["#AV"].angularvelocity=Vector3.new() end end end end
--[=[ Loading logic for Nevermore @private @class LoaderClass ]=]
local Loader = {} Loader.ClassName = "Loader" Loader.__index = Loader function Loader.new(script) return setmetatable({ _script = script; }, Loader) end local function waitForValue(objectValue) local value = objectValue.Value if value then return value end return objectValue.Changed:Wait() end function Loader:__call(value) if type(value) == "string" then local object = self._script.Parent[value] if object:IsA("ObjectValue") then return require(waitForValue(object)) else return require(object) end else return require(value) end end function Loader:__index(value) if type(value) == "string" then local object = self._script.Parent[value] if object:IsA("ObjectValue") then return require(waitForValue(object)) else return require(object) end else return require(value) end end return Loader
--// SETTINGS
local rpmdiv = 280 -- lower = faster; higher = slower local waittime = 0.06 -- time between each update, lowest is 0.06 and highest is 0.3
--FastCast.VisualizeCasts = true
local caster = FastCast.new() local castParams = RaycastParams.new() castParams.FilterType = Enum.RaycastFilterType.Blacklist castParams.IgnoreWater = true local bulletCache = PartCache.new(bulletTemplate, 100, bulletsFolder) local castBehavior = FastCast.newBehavior() castBehavior.RaycastParams = castParams castBehavior.Acceleration = Vector3.new(0, -workspace.Gravity, 0) castBehavior.AutoIgnoreContainer = false castBehavior.CosmeticBulletContainer = bulletsFolder castBehavior.CosmeticBulletProvider = bulletCache local ammoLeft = 30 local reloading = false local function reload() if reloading then return end reloading = true wait(5) ammoLeft = 30 reloading = false end local function onEquipped() castParams.FilterDescendantsInstances = {tool.Parent, bulletsFolder} end local function onLengthChanged(cast, lastPoint, direction, length, velocity, bullet) if bullet then local bulletLength = bullet.Size.Z/2 local offset = CFrame.new(0, 0, -(length - bulletLength)) bullet.CFrame = CFrame.lookAt(lastPoint, lastPoint + direction):ToWorldSpace(offset) end end local function onRayHit(cast, result, velocity, bullet) local hit = result.Instance local character = hit:FindFirstAncestorWhichIsA("Model") if character and character:FindFirstChild("Humanoid") then character.Humanoid:TakeDamage(50) end delay(2, function() bulletCache:ReturnPart(bullet) end) end local function fire(player, mousePosition) if tool.Parent:IsA("Backpack") then return end if ammoLeft > 0 and not reloading then local origin = firePoint.WorldPosition local direction = (mousePosition - origin).Unit caster:Fire(origin, direction, 1000, castBehavior) ammoLeft -= 1 else reload() end end fireEvent.OnServerEvent:Connect(fire) reloadEvent.OnServerEvent:Connect(reload) tool.Equipped:Connect(onEquipped) caster.LengthChanged:Connect(onLengthChanged)
--check mass to see if object is large enough to spray blood on
if dmg<1000 then for x = 1, math.floor(dmg*(math.random(1,7)*.105)) do local bloodRay = Ray.new(origin,(game.Players.LocalPlayer.Character.Torso.CFrame.p.unit * Vector3.new(math.random(-7,7)/60,math.random(-7,7)/60,math.random(-7,7)/60)).unit * 12) local hitPart, hitPoint = workspace:FindPartOnRayWithIgnoreList(bloodRay,{workspace.CurrentCamera,humanoid.Parent}) if hitPart and hitPart.Transparency==0 and hitPart:GetMass() > 5 and hitPart.Anchored then local blood = Instance.new("Part",game.Workspace["Ray_Ignore"]) blood.formFactor = "Custom" blood.Size = Vector3.new(math.random(1,3600)*.001,0.2,math.random(1,3600)*.001) blood.BrickColor = BrickColor.new("Bright red") blood.Anchored = true blood.CanCollide = false Instance.new("BlockMesh",blood).Scale = Vector3.new(math.random(0,112)*.001,0.1,math.random(0,112)*.001) local sc=script.bl:clone() sc.Parent=blood sc.Disabled=false blood.TopSurface = "Smooth" blood.BottomSurface = "Smooth" blood.Reflectance=0.2 blood.Transparency=1 local decalpick=math.random(1,3) if decalpick==1 then local crap=script.Decal1:clone() crap.Name="Decal" crap.Parent=blood elseif decalpick==2 then local crap=script.Decal2:clone() crap.Name="Decal" crap.Parent=blood elseif decalpick==3 then local crap=script.Decal3:clone() crap.Name="Decal" crap.Parent=blood end local normal = GetSurfaceNormal(hitPart,hitPoint).unit if pcall(function() blood.CFrame = CFrame.new(hitPoint,hitPoint + normal) * CFrame.Angles(1.57,math.random(0,300)/100,0) end) then end end end end end local hp=game.Players.LocalPlayer.Character.Humanoid.Health character.Humanoid.HealthChanged:connect(function(health) --[[if game.Workspace:FindFirstChild("Ray_Ignore") then splatterBlood(game.Players.LocalPlayer.Character.Torso.Position,game.Players.LocalPlayer.Character.Humanoid,hp-health) end]]-- hp=game.Players.LocalPlayer.Character.Humanoid.Health healthGUIUpdate(health) end)
-- aboutWindow Functions
local function showAboutWindow() aboutWindow.Visible = true TweenService:Create(aboutWindow, Bar_Button_TweenInfo, {Size = UDim2.new(0,513, 0, 378), GroupTransparency = 0}):Play() end local function hideAboutWindow() TweenService:Create(aboutWindow, Bar_Button_TweenInfo, {Size = UDim2.new(0,500, 0, 365), GroupTransparency = 1}):Play() task.wait(0.3) aboutWindow.Visible = false end
-- Container for temporary connections (disconnected automatically)
local Connections = {}; function DecorateTool.Equip() -- Enables the tool's equipped functionality -- Start up our interface ShowUI(); end; function DecorateTool.Unequip() -- Disables the tool's equipped functionality -- Clear unnecessary resources HideUI(); ClearConnections(); end; function ClearConnections() -- Clears out temporary connections for ConnectionKey, Connection in pairs(Connections) do Connection:disconnect(); Connections[ConnectionKey] = nil; end; end; function ShowUI() -- Creates and reveals the UI -- Reveal UI if already created if DecorateTool.UI then -- Reveal the UI DecorateTool.UI.Visible = true; -- Update the UI every 0.1 seconds UIUpdater = Support.ScheduleRecurringTask(UpdateUI, 0.1); -- Skip UI creation return; end; -- Create the UI DecorateTool.UI = Core.Tool.Interfaces.BTDecorateToolGUI:Clone(); DecorateTool.UI.Parent = Core.UI; DecorateTool.UI.Visible = true; -- Enable each decoration type UI EnableOptionsUI(DecorateTool.UI.Smoke); EnableOptionsUI(DecorateTool.UI.Fire); EnableOptionsUI(DecorateTool.UI.Sparkles); -- Update the UI every 0.1 seconds UIUpdater = Support.ScheduleRecurringTask(UpdateUI, 0.1); end;
-- print("Keyframe : ".. frameName)
local repeatAnim = stopAllAnimations() playAnimation(repeatAnim, 0.0, Humanoid) end end
--[[if JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Thumbnail")then]]-- --[[JeffTheKiller:FindFirstChild("Thumbnail"):Destroy();]]-- --[[end;]]
-- local JeffTheKillerHumanoid; for _,Child in pairs(JeffTheKiller:GetChildren())do if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then JeffTheKillerHumanoid=Child; end; end; local AttackDebounce=false; local JeffTheKillerKnife=JeffTheKiller:FindFirstChild("Knife"); local JeffTheKillerHead=JeffTheKiller:FindFirstChild("Head"); local JeffTheKillerHumanoidRootPart=JeffTheKiller:FindFirstChild("HumanoidRootPart"); local WalkDebounce=false; local Notice=false; local JeffLaughDebounce=false; local MusicDebounce=false; local NoticeDebounce=false; local ChosenMusic; function FindNearestBae() local NoticeDistance=400; local TargetMain; for _,TargetModel in pairs(Game:GetService("Workspace"):GetChildren())do if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and TargetModel.className=="Model"and TargetModel~=JeffTheKiller and TargetModel.Name~=JeffTheKiller.Name and TargetModel:FindFirstChild("HumanoidRootPart")and TargetModel:FindFirstChild("Head")then local TargetPart=TargetModel:FindFirstChild("HumanoidRootPart"); local FoundHumanoid; for _,Child in pairs(TargetModel:GetChildren())do if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then FoundHumanoid=Child; end; end; if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<NoticeDistance then TargetMain=TargetPart; NoticeDistance=(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude; local hit,pos=raycast(JeffTheKillerHumanoidRootPart.Position,(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).unit,500) if hit and hit.Parent and hit.Parent.ClassName=="Model"and hit.Parent:FindFirstChild("HumanoidRootPart")and hit.Parent:FindFirstChild("Head")then if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<9 and not AttackDebounce then Spawn(function() AttackDebounce=true; local SwingAnimation=JeffTheKillerHumanoid:LoadAnimation(JeffTheKiller:FindFirstChild("Swing")); local SwingChoice=math.random(1,2); local HitChoice=math.random(1,3); SwingAnimation:Play(); SwingAnimation:AdjustSpeed(1.5+(math.random()*0.1)); if JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Swing")then local SwingSound=JeffTheKillerKnife:FindFirstChild("Swing"); SwingSound.Pitch=1+(math.random()*0.04); SwingSound:Play(); end; Wait(0.3); if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<8 then FoundHumanoid:TakeDamage(5000); if HitChoice==1 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit1")then local HitSound=JeffTheKillerKnife:FindFirstChild("Hit1"); HitSound.Pitch=1+(math.random()*0.04); HitSound:Play(); elseif HitChoice==2 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit2")then local HitSound=JeffTheKillerKnife:FindFirstChild("Hit2"); HitSound.Pitch=1+(math.random()*0.04); HitSound:Play(); elseif HitChoice==3 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit3")then local HitSound=JeffTheKillerKnife:FindFirstChild("Hit3"); HitSound.Pitch=1+(math.random()*0.04); HitSound:Play(); end; end; Wait(0.1); AttackDebounce=false; end); end; end; end; end; end; return TargetMain; end; while Wait(0)do local TargetPoint=JeffTheKillerHumanoid.TargetPoint; local Blockage,BlockagePos=RayCast((JeffTheKillerHumanoidRootPart.CFrame+CFrame.new(JeffTheKillerHumanoidRootPart.Position,Vector3.new(TargetPoint.X,JeffTheKillerHumanoidRootPart.Position.Y,TargetPoint.Z)).lookVector*(JeffTheKillerHumanoidRootPart.Size.Z/2)).p,JeffTheKillerHumanoidRootPart.CFrame.lookVector,(JeffTheKillerHumanoidRootPart.Size.Z*2.5),{JeffTheKiller,JeffTheKiller}) local Jumpable=false; if Blockage then Jumpable=true; if Blockage and Blockage.Parent and Blockage.Parent.ClassName~="Workspace"then local BlockageHumanoid; for _,Child in pairs(Blockage.Parent:GetChildren())do if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then BlockageHumanoid=Child; end; end; if Blockage and Blockage:IsA("Terrain")then local CellPos=Blockage:WorldToCellPreferSolid((BlockagePos-Vector3.new(0,2,0))); local CellMaterial,CellShape,CellOrientation=Blockage:GetCell(CellPos.X,CellPos.Y,CellPos.Z); if CellMaterial==Enum.CellMaterial.Water then Jumpable=false; end; elseif BlockageHumanoid or Blockage.ClassName=="TrussPart"or Blockage.ClassName=="WedgePart"or Blockage.Name=="Handle"and Blockage.Parent.ClassName=="Hat"or Blockage.Name=="Handle"and Blockage.Parent.ClassName=="Tool"then Jumpable=false; end; end; if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and not JeffTheKillerHumanoid.Sit and Jumpable then JeffTheKillerHumanoid.Jump=true; end; end; if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHumanoidRootPart and JeffTheKillerHead:FindFirstChild("Jeff_Step")and (JeffTheKillerHumanoidRootPart.Velocity-Vector3.new(0,JeffTheKillerHumanoidRootPart.Velocity.y,0)).magnitude>=5 and not WalkDebounce and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then Spawn(function() WalkDebounce=true; local FiredRay=Ray.new(JeffTheKillerHumanoidRootPart.Position,Vector3.new(0,-4,0)); local RayTarget,endPoint=Game:GetService("Workspace"):FindPartOnRay(FiredRay,JeffTheKiller); if RayTarget then local JeffTheKillerHeadFootStepClone=JeffTheKillerHead:FindFirstChild("Jeff_Step"):Clone(); JeffTheKillerHeadFootStepClone.Parent=JeffTheKillerHead; JeffTheKillerHeadFootStepClone:Play(); JeffTheKillerHeadFootStepClone:Destroy(); if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and JeffTheKillerHumanoid.WalkSpeed<17 then Wait(0.5); elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and JeffTheKillerHumanoid.WalkSpeed>17 then Wait(0.2); end end; WalkDebounce=false; end); end; local MainTarget=FindNearestBae(); local FoundHumanoid; if MainTarget then for _,Child in pairs(MainTarget.Parent:GetChildren())do if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then FoundHumanoid=Child; end; end; end; if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and MainTarget.Parent and FoundHumanoid and FoundHumanoid.Jump then JeffTheKillerHumanoid.Jump=true; end; if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<25 then if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")and not JeffTheKillerHead:FindFirstChild("Jeff_Laugh").IsPlaying then JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=1; JeffTheKillerHead:FindFirstChild("Jeff_Laugh"):Play(); end; elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>25 then if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")and JeffTheKillerHead:FindFirstChild("Jeff_Laugh").IsPlaying then if not JeffLaughDebounce then Spawn(function() JeffLaughDebounce=true; repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")then JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume-0.1;else break;end;until JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume==0 or JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume<0; JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=0; JeffTheKillerHead:FindFirstChild("Jeff_Laugh"):Stop(); JeffLaughDebounce=false; end); end; end; end; if not ChosenMusic and JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<50 then local MusicChoice=math.random(1,2); if MusicChoice==1 and JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Jeff_Scene_Sound1")then ChosenMusic=JeffTheKiller:FindFirstChild("Jeff_Scene_Sound1"); elseif MusicChoice==2 and JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Jeff_Scene_Sound2")then ChosenMusic=JeffTheKiller:FindFirstChild("Jeff_Scene_Sound2"); end; if JeffTheKillerScript and JeffTheKiller and ChosenMusic and not ChosenMusic.IsPlaying then ChosenMusic.Volume=0.5; ChosenMusic:Play(); end; elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>50 then if JeffTheKillerScript and JeffTheKiller and ChosenMusic and ChosenMusic.IsPlaying then if not MusicDebounce then Spawn(function() MusicDebounce=true; repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and ChosenMusic then ChosenMusic.Volume=ChosenMusic.Volume-0.01;else break;end;until ChosenMusic.Volume==0 or ChosenMusic.Volume<0; if ChosenMusic then ChosenMusic.Volume=0; ChosenMusic:Stop(); end; ChosenMusic=nil; MusicDebounce=false; end); end; end; end; if not MainTarget and not JeffLaughDebounce then Spawn(function() JeffLaughDebounce=true; repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")then JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume-0.1;else break;end;until JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume==0 or JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume<0; JeffLaughDebounce=false; end); end; if not MainTarget and not MusicDebounce then Spawn(function() MusicDebounce=true; repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and ChosenMusic then ChosenMusic.Volume=ChosenMusic.Volume-0.01;else break;end;until ChosenMusic.Volume==0 or ChosenMusic.Volume<0; if ChosenMusic then ChosenMusic.Volume=0; ChosenMusic:Stop(); end; ChosenMusic=nil; MusicDebounce=false; end); end; if MainTarget then Notice=true; if Notice and not NoticeDebounce and JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Susto2")then JeffTheKillerHead:FindFirstChild("Jeff_Susto2"):Play(); NoticeDebounce=true; end if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then if MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>5 then JeffTheKillerHumanoid.WalkSpeed=38; elseif MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<5 then JeffTheKillerHumanoid.WalkSpeed=0.004; end; JeffTheKillerHumanoid:MoveTo(MainTarget.Position+(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).unit*2,Game:GetService("Workspace"):FindFirstChild("Terrain")); end; else Notice=false; NoticeDebounce=false; local RandomWalk=math.random(1,150); if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then JeffTheKillerHumanoid.WalkSpeed=12; if RandomWalk==1 then JeffTheKillerHumanoid:MoveTo(Game:GetService("Workspace"):FindFirstChild("Terrain").Position+Vector3.new(math.random(-2048,2048),0,math.random(-2048,2048)),Game:GetService("Workspace"):FindFirstChild("Terrain")); end; end; end; if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid then JeffTheKillerHumanoid.DisplayDistanceType="None"; JeffTheKillerHumanoid.HealthDisplayDistance=0; JeffTheKillerHumanoid.Name="ColdBloodedKiller"; JeffTheKillerHumanoid.NameDisplayDistance=0; JeffTheKillerHumanoid.NameOcclusion="EnemyOcclusion"; JeffTheKillerHumanoid.AutoJumpEnabled=true; JeffTheKillerHumanoid.AutoRotate=true; JeffTheKillerHumanoid.MaxHealth=1300; JeffTheKillerHumanoid.JumpPower=60; JeffTheKillerHumanoid.MaxSlopeAngle=89.9; end; if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and not JeffTheKillerHumanoid.AutoJumpEnabled then JeffTheKillerHumanoid.AutoJumpEnabled=true; end; if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and not JeffTheKillerHumanoid.AutoRotate then JeffTheKillerHumanoid.AutoRotate=true; end; if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.PlatformStand then JeffTheKillerHumanoid.PlatformStand=false; end; if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Sit then JeffTheKillerHumanoid.Sit=false; end; end;
--Change sound id to the id you want to play
debounce = false script.Parent.Touched:connect(function(hit) if not debounce then debounce = true if(hit.Parent:FindFirstChild("Humanoid")~=nil)then local player = game.Players:GetPlayerFromCharacter(hit.Parent) local sound = script.Parent.Sound:Clone() sound.Parent = player.PlayerGui sound:Play() wait(0)--change to how long before the sound plays again after retouching it end debounce = false end end)
-- maps a value from one range to another, clamping to the output range. order does not matter
function CameraUtils.mapClamp(x, inMin, inMax, outMin, outMax) return math.clamp( (x - inMin)*(outMax - outMin)/(inMax - inMin) + outMin, math.min(outMin, outMax), math.max(outMin, outMax) ) end