prompt
stringlengths
2
14.7k
completion
stringlengths
1
99.7k
-- The middle number adjusts how high/low the hat will be placed on the head. The higher the number is, the lower the hat will be -- placed. If you are at zero, and you want the hat to go lower, make the number a negative. Negative numbers will make the hat -- be place higher on your robloxian head.
--[[Flip]]
local function Flip() --Detect Orientation if (car.DriveSeat.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector.y > .1 or FlipDB then FlipWait=tick() --Apply Flip else if tick()-FlipWait>=3 then FlipDB=true local gyro = car.DriveSeat.Flip gyro.maxTorque = Vector3.new(10000,0,10000) gyro.P=3000 gyro.D=500 wait(1) gyro.maxTorque = Vector3.new(0,0,0) gyro.P=0 gyro.D=0 FlipDB=false end end end
-- listeners
local function onProductPurchased(player, id) local product, class = getAsset(id) if product then local data = Datastore:GetData(player) if product.onPurchased then product.onPurchased(player) end if class == "Passes" and data then local gamepasses = data.Gamepasses or {} table.insert(gamepasses, product.Id) data.Gamepasses = gamepasses end end end MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, id, success) if (success and player.Parent) then onProductPurchased(player, id) game.ReplicatedStorage.RE.gamepassUpdate:FireClient(player, getNameFromID(id)) end end) MarketplaceService.PromptProductPurchaseFinished:Connect(function(userid, id, success) local player = game.Players:GetPlayerByUserId(userid) if (success and player and player.Parent) then onProductPurchased(player, id) end end)
--[[ ___ _______ _ / _ |____/ ___/ / ___ ____ ___ (_)__ / __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-< /_/ |_| \___/_//_/\_,_/___/___/_/___/ SecondLogic @ Inspare ]]
local autoscaling = false --Estimates top speed local UNITS = { --Click on speed to change units --First unit is default { units = "KM/H" , scaling = (10/12) * 1.09728 , -- 1 stud : 10 inches | ft/s to MPH maxSpeed = 370 , spInc = 40 , -- Increment between labelled notches }, { units = "KM/H" , scaling = (10/12) * 1.09728 , -- 1 stud : 10 inches | ft/s to KP/H maxSpeed = 370 , spInc = 40 , -- Increment between labelled notches }, { units = "SPS" , scaling = 1 , -- Roblox standard maxSpeed = 400 , spInc = 40 , -- Increment between labelled notches } }
-- print("Wha " .. pose)
amplitude = 0.1 frequency = 1 setAngles = true end if (setAngles) then local desiredAngle = amplitude * math.sin(time * frequency) RightShoulder:SetDesiredAngle(desiredAngle + climbFudge) LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge) RightHip:SetDesiredAngle(-desiredAngle) LeftHip:SetDesiredAngle(-desiredAngle) end -- Tool Animation handling local tool = getTool() if tool then local animStringValueObject = getToolAnim(tool) if animStringValueObject then toolAnim = animStringValueObject.Value -- message recieved, delete StringValue animStringValueObject.Parent = nil toolAnimTime = time + .3 end if time > toolAnimTime then toolAnimTime = 0 toolAnim = "None" end animateTool() else stopToolAnimations() toolAnim = "None" toolAnimTime = 0 end end
-- Handle event fire
local function toggleDoor(player, door) -- Check distance to the character's Torso. If too far, don't do anything if player.Character and player.Character:FindFirstChild("Torso") then local torso = player.Character:FindFirstChild("Torso") local toTorso = torso.Position - stove.Door.Position if toTorso.magnitude < clickDistance then if open then ovenMotor.DesiredAngle = 0 open = false else ovenMotor.DesiredAngle = math.pi/2 open = true end end end end stove.DoorPadding.ROBLOXInteractionEvent.OnServerEvent:connect(function(player, arguments) toggleDoor(player) end) stove.Door.ROBLOXInteractionEvent.OnServerEvent:connect(function(player, arguments) toggleDoor(player) end)
--[[ * Look for single edits surrounded on both sides by equalities * which can be shifted sideways to align the edit to a word boundary. * e.g: The c<ins>at c</ins>ame. -> The <ins>cat </ins>came. * @param {Array.<Array.<number|string>>} diffs Array of diff tuples. --]]
_diff_cleanupSemanticLossless = function(diffs: Array<Diff>) local pointer = 2 -- Intentionally ignore the first and last element (don't need checking). while diffs[pointer + 1] do local prevDiff, nextDiff = diffs[pointer - 1], diffs[pointer + 1] if prevDiff[1] == DIFF_EQUAL and nextDiff[1] == DIFF_EQUAL then -- This is a single edit surrounded by equalities. local diff = diffs[pointer] local equality1 = prevDiff[2] local edit = diff[2] local equality2 = nextDiff[2] -- First, shift the edit as far left as possible. local commonOffset = _diff_commonSuffix(equality1, edit) if commonOffset > 0 then local commonString = strsub(edit, -commonOffset) equality1 = strsub(equality1, 1, -commonOffset - 1) edit = commonString .. strsub(edit, 1, -commonOffset - 1) equality2 = commonString .. equality2 end -- Second, step character by character right, looking for the best fit. local bestEquality1 = equality1 local bestEdit = edit local bestEquality2 = equality2 local bestScore = _diff_cleanupSemanticScore(equality1, edit) + _diff_cleanupSemanticScore(edit, equality2) while strbyte(edit, 1) == strbyte(equality2, 1) do equality1 = equality1 .. strsub(edit, 1, 1) edit = strsub(edit, 2) .. strsub(equality2, 1, 1) equality2 = strsub(equality2, 2) local score = _diff_cleanupSemanticScore(equality1, edit) + _diff_cleanupSemanticScore(edit, equality2) -- The >= encourages trailing rather than leading whitespace on edits. if score >= bestScore then bestScore = score bestEquality1 = equality1 bestEdit = edit bestEquality2 = equality2 end end if prevDiff[2] ~= bestEquality1 then -- We have an improvement, save it back to the diff. if #bestEquality1 > 0 then diffs[pointer - 1][2] = bestEquality1 else tremove(diffs, pointer - 1) pointer = pointer - 1 end diffs[pointer][2] = bestEdit if #bestEquality2 > 0 then diffs[pointer + 1][2] = bestEquality2 else tremove(diffs, pointer + 1) pointer -= 1 end end end pointer += 1 end end
-- ======================================== -- ActionManager -- ======================================== -- Bind/Unbind actions
function ActionManager:BindGameActions(players) for i, player in pairs(players) do bind:FireClient(player, "Action1", Enum.UserInputType.MouseButton1, Enum.KeyCode.ButtonR2) end end function ActionManager:UnbindGameActions(players) for i, player in pairs(players) do unbind:FireClient(player, "Action1") end end
---------- Brake Lights On ----------
lights.Brake1.BrickColor = BrickColor.new("Really red") lights.Brake2.BrickColor = BrickColor.new("Really red") lights.Brake1.Material = "Neon" lights.Brake2.Material = "Neon" end end
--ball.SparkSound.Looped = false --ball.SparkSound:Stop()
ball.Parent = nil
-- Shorthand for creating a tweenable "variable" using value object
local function makeProperty(valueObjectClass, defaultValue, setter) local valueObject = Instance.new(valueObjectClass) if defaultValue then valueObject.Value = defaultValue end valueObject.Changed:connect(setter) setter(valueObject.Value) return valueObject end local Color = makeProperty("Color3Value", RAIN_DEFAULT_COLOR, function(value) local value = ColorSequence.new(value) Emitter.RainStraight.Color = value Emitter.RainTopDown.Color = value for _,v in pairs(splashAttachments) do v.RainSplash.Color = value end for _,v in pairs(rainAttachments) do v.RainStraight.Color = value v.RainTopDown.Color = value end end) local function updateTransparency(value) local opacity = (1 - value) * (1 - GlobalModifier.Value) local transparency = 1 - opacity straightLowAlpha = RAIN_STRAIGHT_ALPHA_LOW * opacity + transparency topdownLowAlpha = RAIN_TOPDOWN_ALPHA_LOW * opacity + transparency local splashSequence = NumberSequence.new { NSK010; NumberSequenceKeypoint.new(RAIN_TRANSPARENCY_T1, opacity*RAIN_SPLASH_ALPHA_LOW + transparency, 0); NumberSequenceKeypoint.new(RAIN_TRANSPARENCY_T2, opacity*RAIN_SPLASH_ALPHA_LOW + transparency, 0); NSK110; } for _,v in pairs(splashAttachments) do v.RainSplash.Transparency = splashSequence end end local Transparency = makeProperty("NumberValue", RAIN_DEFAULT_TRANSPARENCY, updateTransparency) GlobalModifier.Changed:connect(updateTransparency) local SpeedRatio = makeProperty("NumberValue", RAIN_DEFAULT_SPEEDRATIO, function(value) Emitter.RainStraight.Speed = NumberRange.new(value * RAIN_STRAIGHT_MAX_SPEED) Emitter.RainTopDown.Speed = NumberRange.new(value * RAIN_TOPDOWN_MAX_SPEED) end) local IntensityRatio = makeProperty("NumberValue", RAIN_DEFAULT_INTENSITYRATIO, function(value) Emitter.RainStraight.Rate = RAIN_STRAIGHT_MAX_RATE * value Emitter.RainTopDown.Rate = RAIN_TOPDOWN_MAX_RATE * value intensityOccludedRain = math.ceil(RAIN_OCCLUDED_MAXINTENSITY * value) numSplashes = RAIN_SPLASH_NUM * value end) local LightEmission = makeProperty("NumberValue", RAIN_DEFAULT_LIGHTEMISSION, function(value) Emitter.RainStraight.LightEmission = value Emitter.RainTopDown.LightEmission = value for _,v in pairs(rainAttachments) do v.RainStraight.LightEmission = value v.RainTopDown.LightEmission = value end for _,v in pairs(splashAttachments) do v.RainSplash.LightEmission = value end end) local LightInfluence = makeProperty("NumberValue", RAIN_DEFAULT_LIGHTINFLUENCE, function(value) Emitter.RainStraight.LightInfluence = value Emitter.RainTopDown.LightInfluence = value for _,v in pairs(rainAttachments) do v.RainStraight.LightInfluence = value v.RainTopDown.LightInfluence = value end for _,v in pairs(splashAttachments) do v.RainSplash.LightInfluence = value end end) local RainDirection = makeProperty("Vector3Value", RAIN_DEFAULT_DIRECTION, function(value) if value.magnitude > 0.001 then rainDirection = value.unit end end)
--[[------------------------------------- REMOTE FUNCTIONS ------------------------------]]
-- local function validateAndSendSoundRequest(requestingPly, parent, soundObj, vol, pit, timePos) if not soundObj then return end for _, v in pairs(serverWorkerModule.getAllOtherPlayers(requestingPly)) do playSoundEffectEvent:FireClient(v, parent, soundObj, vol, pit, timePos) end end
-- Settings
local allow_duplicates = false local allow_team ={ "Players", "Players" }
--not sure --local function PlaySound() -- game.SoundSerivce.SealOrb:Play() --end --
local triggerEnabled = true local function touched(otherPart) if( not triggerEnabled ) then return end if(otherPart.Name == "HumanoidRootPart" ) then local player = game.Players:FindFirstChild(otherPart.Parent.Name) if(player) then triggerEnabled = false staticCorrupt.Transparency = 0 imageLableCorrupt.ImageTransparency = 0 -- PlaySound("") wait( 4 ) --How long the Corrupt screen is visable staticCorrupt.Transparency = 1 imageLableCorrupt.ImageTransparency = 1 trigger.CanTouch = false wait(10) ---How long before the trigger can be touched agian trigger.CanTouch = true triggerEnabled = true end end end trigger.Touched:Connect(touched)
-- How many studs the zombie can wander on the x and z axis in studs ; 0, 0 to stay still
-- functions
function onRunning(speed) if isSeated then return end if speed>0 then pose = "Running" else pose = "Standing" end end function onDied() pose = "Dead" end function onJumping() isSeated = false pose = "Jumping" end function onClimbing() pose = "Climbing" end function onGettingUp() pose = "GettingUp" end function onFreeFall() pose = "FreeFall" end function onFallingDown() pose = "FallingDown" end function onSeated() isSeated = true pose = "Seated" print("Seated") end function moveJump() RightShoulder.MaxVelocity = 0.5 LeftShoulder.MaxVelocity = 0.5 RightShoulder.DesiredAngle = 3.14 LeftShoulder.DesiredAngle = -3.14 RightHip.DesiredAngle = 0 LeftHip.DesiredAngle = 0 end function moveFreeFall() RightShoulder.MaxVelocity = 0.5 LeftShoulder.MaxVelocity = 0.5 RightShoulder.DesiredAngle = 1 LeftShoulder.DesiredAngle = -1 RightHip.DesiredAngle = 0 LeftHip.DesiredAngle = 0 end function moveClimb() RightShoulder.MaxVelocity = 0.5 LeftShoulder.MaxVelocity = 0.5 RightShoulder.DesiredAngle = -3.14 LeftShoulder.DesiredAngle = 3.14 RightHip.DesiredAngle = 0 LeftHip.DesiredAngle = 0 end function moveSit() print("Move Sit") RightShoulder.MaxVelocity = 0.15 LeftShoulder.MaxVelocity = 0.15 RightShoulder.DesiredAngle = 3.14 /2 LeftShoulder.DesiredAngle = -3.14 /2 RightHip.DesiredAngle = 3.14 /2 LeftHip.DesiredAngle = -3.14 /2 end function getTool() kidTable = Figure:children() if (kidTable ~= nil) then numKids = #kidTable for i=1,numKids do if (kidTable[i].className == "Tool") then return kidTable[i] end end end return nil end function getToolAnim(tool) c = tool:children() for i=1,#c do if (c[i].Name == "toolanim" and c[i].className == "StringValue") then return c[i] end end return nil end function animateTool() if (toolAnim == "None") then RightShoulder.DesiredAngle = 1.57 return end if (toolAnim == "Slash") then RightShoulder.MaxVelocity = 0.5 RightShoulder.DesiredAngle = 0 return end if (toolAnim == "Lunge") then RightShoulder.MaxVelocity = 0.5 LeftShoulder.MaxVelocity = 0.5 RightHip.MaxVelocity = 0.5 LeftHip.MaxVelocity = 0.5 RightShoulder.DesiredAngle = 1.57 LeftShoulder.DesiredAngle = 1.0 RightHip.DesiredAngle = 1.57 LeftHip.DesiredAngle = 1.0 return end end function move(time) local amplitude local frequency if (pose == "Jumping") then moveJump() return end if (pose == "FreeFall") then moveFreeFall() return end if (pose == "Climbing") then moveClimb() return end if (pose == "Seated") then moveSit() return end RightShoulder.MaxVelocity = 0.15 LeftShoulder.MaxVelocity = 0.15 if (pose == "Running") then amplitude = 1 frequency = 9 else amplitude = 0.1 frequency = 1 end desiredAngle = amplitude * math.sin(time*frequency) RightShoulder.DesiredAngle = desiredAngle LeftShoulder.DesiredAngle = desiredAngle RightHip.DesiredAngle = -desiredAngle LeftHip.DesiredAngle = -desiredAngle local tool = getTool() if tool ~= nil then animStringValueObject = getToolAnim(tool) if animStringValueObject ~= nil then toolAnim = animStringValueObject.Value -- message recieved, delete StringValue animStringValueObject.Parent = nil toolAnimTime = time + .3 end if time > toolAnimTime then toolAnimTime = 0 toolAnim = "None" end animateTool() else toolAnim = "None" toolAnimTime = 0 end end
--------------| MODIFY COMMANDS |--------------
SetCommandRankByName = { --["jump"] = "VIP"; }; SetCommandRankByTag = { --["abusive"] = "Admin"; }; };
-- fetch the ID list
local IDList = require(script.Parent.IDList)
--[[ Public API ]]
-- function DPad:Enable() DPadFrame.Visible = true end function DPad:Disable() DPadFrame.Visible = false OnInputEnded() end function DPad:Create(parentFrame) if DPadFrame then DPadFrame:Destroy() DPadFrame = nil end local position = UDim2.new(0, 10, 1, -230) DPadFrame = Instance.new('Frame') DPadFrame.Name = "DPadFrame" DPadFrame.Active = true DPadFrame.Visible = false DPadFrame.Size = UDim2.new(0, 192, 0, 192) DPadFrame.Position = position DPadFrame.BackgroundTransparency = 1 local smArrowSize = UDim2.new(0, 23, 0, 23) local lgArrowSize = UDim2.new(0, 64, 0, 64) local smImgOffset = Vector2.new(46, 46) local lgImgOffset = Vector2.new(128, 128) local bBtn = createArrowLabel("BackButton", UDim2.new(0.5, -32, 1, -64), lgArrowSize, Vector2.new(0, 0), lgImgOffset) local fBtn = createArrowLabel("ForwardButton", UDim2.new(0.5, -32, 0, 0), lgArrowSize, Vector2.new(0, 258), lgImgOffset) local lBtn = createArrowLabel("LeftButton", UDim2.new(0, 0, 0.5, -32), lgArrowSize, Vector2.new(129, 129), lgImgOffset) local rBtn = createArrowLabel("RightButton", UDim2.new(1, -64, 0.5, -32), lgArrowSize, Vector2.new(0, 129), lgImgOffset) local jumpBtn = createArrowLabel("JumpButton", UDim2.new(0.5, -32, 0.5, -32), lgArrowSize, Vector2.new(129, 0), lgImgOffset) local flBtn = createArrowLabel("ForwardLeftButton", UDim2.new(0, 35, 0, 35), smArrowSize, Vector2.new(129, 258), smImgOffset) local frBtn = createArrowLabel("ForwardRightButton", UDim2.new(1, -55, 0, 35), smArrowSize, Vector2.new(176, 258), smImgOffset) flBtn.Visible = false frBtn.Visible = false -- input connections jumpBtn.InputBegan:connect(function(inputObject) MasterControl:DoJump() end) local movementVector = Vector3.new(0,0,0) local function normalizeDirection(inputPosition) local jumpRadius = jumpBtn.AbsoluteSize.x/2 local centerPosition = getCenterPosition() local direction = Vector2.new(inputPosition.x - centerPosition.x, inputPosition.y - centerPosition.y) if direction.magnitude > jumpRadius then local angle = ATAN2(direction.y, direction.x) local octant = (FLOOR(8 * angle / (2 * PI) + 8.5)%8) + 1 movementVector = COMPASS_DIR[octant] end if not flBtn.Visible and movementVector == COMPASS_DIR[7] then flBtn.Visible = true frBtn.Visible = true end end DPadFrame.InputBegan:connect(function(inputObject) if TouchObject or inputObject.UserInputType ~= Enum.UserInputType.Touch then return end MasterControl:AddToPlayerMovement(-movementVector) TouchObject = inputObject normalizeDirection(TouchObject.Position) MasterControl:AddToPlayerMovement(movementVector) end) DPadFrame.InputChanged:connect(function(inputObject) if inputObject == TouchObject then MasterControl:AddToPlayerMovement(-movementVector) normalizeDirection(TouchObject.Position) MasterControl:AddToPlayerMovement(movementVector) end end) OnInputEnded = function() TouchObject = nil flBtn.Visible = false frBtn.Visible = false MasterControl:AddToPlayerMovement(-movementVector) movementVector = Vector3.new(0, 0, 0) end DPadFrame.InputEnded:connect(function(inputObject) if inputObject == TouchObject then OnInputEnded() end end) DPadFrame.Parent = parentFrame end return DPad
--[[Initialize]]
script.Parent:WaitForChild("A-Chassis Interface") script.Parent:WaitForChild("Plugins") script.Parent:WaitForChild("README") local car=script.Parent.Parent local _Tune=require(script.Parent) wait(_Tune.LoadDelay) --Weight Scaling local weightScaling = _Tune.WeightScaling if not workspace:PGSIsEnabled() then weightScaling = _Tune.LegacyScaling end local Drive=car.Wheels:GetChildren() --Remove Existing Mass function DReduce(p) for i,v in pairs(p:GetChildren())do if v:IsA("BasePart") then if v.CustomPhysicalProperties == nil then v.CustomPhysicalProperties = PhysicalProperties.new(v.Material) end v.CustomPhysicalProperties = PhysicalProperties.new( 0, v.CustomPhysicalProperties.Friction, v.CustomPhysicalProperties.Elasticity, v.CustomPhysicalProperties.FrictionWeight, v.CustomPhysicalProperties.ElasticityWeight ) end DReduce(v) end end DReduce(car)
-- Functions
function httpGet(url) return game:HttpGet(url,true) end
-- setup emote chat hook
game:GetService("Players").LocalPlayer.Chatted:connect(function(msg) local emote = "" if (string.sub(msg, 1, 3) == "/e ") then emote = string.sub(msg, 4) elseif (string.sub(msg, 1, 7) == "/emote ") then emote = string.sub(msg, 8) end if (pose == "Standing" and emoteNames[emote] ~= nil) then playAnimation(emote, 0.1, Humanoid) end end)
--[[ OrbitalCamera - Spherical coordinates control camera for top-down games 2018 Camera Update - AllYourBlox --]]
---------------------------------- ------------FUNCTIONS------------- ----------------------------------
function Receive(player, action, ...) local args = {...} if player == User and action == "play" then Connector:FireAllClients("play", User, args[1], Settings.SoundSource.Position, Settings.PianoSoundRange, Settings.PianoSounds, args[2], Settings.IsCustom) HighlightPianoKey((args[1] > 61 and 61) or (args[1] < 1 and 1) or args[1],args[3]) elseif player == User and action == "abort" then Deactivate() if SeatWeld then SeatWeld:remove() end end end function Activate(player) Connector:FireClient(player, "activate", Settings.CameraCFrame, Settings.PianoSounds, true) User = player end function Deactivate() if User and User.Parent then Connector:FireClient(User, "deactivate") User.Character:SetPrimaryPartCFrame(Box.CFrame + Vector3.new(0, 5, 0)) end User = nil end
-- Local Functions
local function GetTeamFromColor(teamColor) for _, team in ipairs(Teams:GetTeams()) do if team.TeamColor == teamColor then return team end end return nil end
--[[Drivetrain]]
Tune.Config = "RWD" --"FWD" , "RWD" , "AWD" --Differential Settings Tune.FDiffSlipThres = 50 -- 1 - 100% (Max threshold of applying full lock determined by deviation from avg speed) Tune.FDiffLockThres = 0 -- 0 - 100% (0 - Bias toward slower wheel, 100 - Bias toward faster wheel) Tune.RDiffSlipThres = 100 -- 1 - 100% Tune.RDiffLockThres = 0 -- 0 - 100% Tune.CDiffSlipThres = 1 -- 1 - 100% [AWD Only] Tune.CDiffLockThres = 0 -- 0 - 100% [AWD Only] --Traction Control Settings Tune.TCSEnabled = false -- Implements TCS Tune.TCSThreshold = 20 -- Slip speed allowed before TCS starts working (in SPS) Tune.TCSGradient = 20 -- Slip speed gradient between 0 to max reduction (in SPS) Tune.TCSLimit = 10 -- Minimum amount of torque at max reduction (in percent)
--Disconnect MoveToFinished connection when pathfinding ends
local function disconnectMoveConnection(self) self._moveConnection:Disconnect() self._moveConnection = nil end
-- / Wind Shake / --
WindShake:SetDefaultSettings(WindShakeSettings) WindShake:Init() for _, ShakeObject in pairs(game.Workspace:GetDescendants()) do if ShakeObject:IsA("BasePart") then if table.find(ShakableObjects, ShakeObject.Name) then WindShake:AddObjectShake(ShakeObject, WindShakeSettings) end end end game.Workspace.DescendantAdded:Connect(function(Object) if table.find(ShakableObjects, Object.Name) then WindShake:AddObjectShake(Object, WindShakeSettings) end end)
--[=[ Alias for [Subscription.Destroy]. ]=]
function Subscription:Disconnect() self:Destroy() end return Subscription
--pathfind
function GoTo(Target) Path:ComputeAsync(NPC.HumanoidRootPart.Position, Target) if Path.Status == Enum.PathStatus.NoPath then else local WayPoints = Path:GetWaypoints() for _, WayPoint in ipairs(WayPoints) do NPC.Humanoid:MoveTo(WayPoint.Position) if WayPoint.Action == Enum.PathWaypointAction.Jump then NPC.Humanoid.Jump = true end end end end
-- idle bob settings
local speed = 1.5 local intensity = 0.2 local smoothness = 0.2
---------------------------------------------------------------------------------------------------------------------------------------------------------------- -- Events ----------------------------------------------------------------------------------------------------------------------------------------------------------------
camera.Changed:connect(function() local dis = (game.Lighting:GetSunDirection()-camera.CoordinateFrame.lookVector).magnitude local parts = camera:GetPartsObscuringTarget({camera.CoordinateFrame,game.Lighting:GetSunDirection()*10000},{((camera.CoordinateFrame.p-player.Character.Head.Position).magnitude < 1 and player.Character or nil)}) if dis > 1 then dis = 1 end for i = 1,#parts do if parts[i] then dis = 1 break end end ts:Create(blind,TweenInfo.new(0.5,Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0,false,0),{ Brightness = (1-dis)*0.35 }):Play() ts:Create(blur,TweenInfo.new(0.5,Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0,false,0),{ Size = 15*(1-dis) }):Play() end)
-- Gamepad thumbstick utilities
local k = 0.5 local lowerK = 0.9 local function SCurveTransform(t) t = math.clamp(t, -1,1) if t >= 0 then return (k*t) / (k - t + 1) end return -((lowerK*-t) / (lowerK + t + 1)) end local DEADZONE = 0.25 local function toSCurveSpace(t) return (1 + DEADZONE) * (2*math.abs(t) - 1) - DEADZONE end local function fromSCurveSpace(t) return t/2 + 0.5 end
--bendarobloxian 2020, Owner Title Script Version 4.2 | Now supporting rainbow colors, but with a less colorful and more simplistic icon.
-- щит над деревней
me = script.Parent me.Position = Vector3.new(0,0,0) local radius = game.Workspace.Village.Radius.Value me.Size = Vector3.new(radius,radius,radius)
--////////////////////////////// Methods --//////////////////////////////////////
local methods = {} methods.__index = methods local function CreateGuiObjects() local BaseFrame = Instance.new("Frame") BaseFrame.Selectable = false BaseFrame.Size = UDim2.new(1, 0, 1, 0) BaseFrame.BackgroundTransparency = 1 local Scroller = Instance.new("ScrollingFrame") Scroller.Selectable = ChatSettings.GamepadNavigationEnabled Scroller.Name = "Scroller" Scroller.BackgroundTransparency = 1 Scroller.BorderSizePixel = 0 Scroller.Position = UDim2.new(0, 0, 0, 3) Scroller.Size = UDim2.new(1, -4, 1, -6) Scroller.CanvasSize = UDim2.new(0, 0, 0, 0) Scroller.ScrollBarThickness = module.ScrollBarThickness Scroller.Active = false Scroller.Parent = BaseFrame local Layout = Instance.new("UIListLayout") Layout.SortOrder = Enum.SortOrder.LayoutOrder Layout.Parent = Scroller return BaseFrame, Scroller, Layout end function methods:Destroy() self.GuiObject:Destroy() self.Destroyed = true end function methods:SetActive(active) self.GuiObject.Visible = active end function methods:UpdateMessageFiltered(messageData) local messageObject = nil local searchIndex = 1 local searchTable = self.MessageObjectLog while (#searchTable >= searchIndex) do local obj = searchTable[searchIndex] if obj.ID == messageData.ID then messageObject = obj break end searchIndex = searchIndex + 1 end if messageObject then messageObject.UpdateTextFunction(messageData) self:PositionMessageLabelInWindow(messageObject, searchIndex) end end function methods:AddMessage(messageData) self:WaitUntilParentedCorrectly() local messageObject = MessageLabelCreator:CreateMessageLabel(messageData, self.CurrentChannelName) if messageObject == nil then return end table.insert(self.MessageObjectLog, messageObject) self:PositionMessageLabelInWindow(messageObject, #self.MessageObjectLog) end function methods:AddMessageAtIndex(messageData, index) local messageObject = MessageLabelCreator:CreateMessageLabel(messageData, self.CurrentChannelName) if messageObject == nil then return end table.insert(self.MessageObjectLog, index, messageObject) self:PositionMessageLabelInWindow(messageObject, index) end function methods:RemoveLastMessage() self:WaitUntilParentedCorrectly() local lastMessage = self.MessageObjectLog[1] lastMessage:Destroy() table.remove(self.MessageObjectLog, 1) end function methods:IsScrolledDown() local yCanvasSize = self.Scroller.CanvasSize.Y.Offset local yContainerSize = self.Scroller.AbsoluteWindowSize.Y local yScrolledPosition = self.Scroller.CanvasPosition.Y return (yCanvasSize < yContainerSize or yCanvasSize - yScrolledPosition <= yContainerSize + 5) end function methods:UpdateMessageTextHeight(messageObject) local baseFrame = messageObject.BaseFrame for i = 1, 10 do if messageObject.BaseMessage.TextFits then break end local trySize = self.Scroller.AbsoluteSize.X - i baseFrame.Size = UDim2.new(1, 0, 0, messageObject.GetHeightFunction(trySize)) end end function methods:PositionMessageLabelInWindow(messageObject, index) self:WaitUntilParentedCorrectly() local wasScrolledDown = self:IsScrolledDown() local baseFrame = messageObject.BaseFrame local layoutOrder = 1 if self.MessageObjectLog[index - 1] then if index == #self.MessageObjectLog then layoutOrder = self.MessageObjectLog[index - 1].BaseFrame.LayoutOrder + 1 else layoutOrder = self.MessageObjectLog[index - 1].BaseFrame.LayoutOrder end end baseFrame.LayoutOrder = layoutOrder baseFrame.Size = UDim2.new(1, 0, 0, messageObject.GetHeightFunction(self.Scroller.AbsoluteSize.X)) baseFrame.Parent = self.Scroller if messageObject.BaseMessage then self:UpdateMessageTextHeight(messageObject) end if wasScrolledDown then self.Scroller.CanvasPosition = Vector2.new( 0, math.max(0, self.Scroller.CanvasSize.Y.Offset - self.Scroller.AbsoluteSize.Y)) end end function methods:ReorderAllMessages() self:WaitUntilParentedCorrectly() --// Reordering / reparenting with a size less than 1 causes weird glitches to happen -- with scrolling as repositioning happens. if self.GuiObject.AbsoluteSize.Y < 1 then return end local oldCanvasPositon = self.Scroller.CanvasPosition local wasScrolledDown = self:IsScrolledDown() for _, messageObject in pairs(self.MessageObjectLog) do self:UpdateMessageTextHeight(messageObject) end if not wasScrolledDown then self.Scroller.CanvasPosition = oldCanvasPositon else self.Scroller.CanvasPosition = Vector2.new( 0, math.max(0, self.Scroller.CanvasSize.Y.Offset - self.Scroller.AbsoluteSize.Y)) end end function methods:Clear() for _, v in pairs(self.MessageObjectLog) do v:Destroy() end self.MessageObjectLog = {} end function methods:SetCurrentChannelName(name) self.CurrentChannelName = name end function methods:FadeOutBackground(duration) --// Do nothing end function methods:FadeInBackground(duration) --// Do nothing end function methods:FadeOutText(duration) for i = 1, #self.MessageObjectLog do if self.MessageObjectLog[i].FadeOutFunction then self.MessageObjectLog[i].FadeOutFunction(duration, CurveUtil) end end end function methods:FadeInText(duration) for i = 1, #self.MessageObjectLog do if self.MessageObjectLog[i].FadeInFunction then self.MessageObjectLog[i].FadeInFunction(duration, CurveUtil) end end end function methods:Update(dtScale) for i = 1, #self.MessageObjectLog do if self.MessageObjectLog[i].UpdateAnimFunction then self.MessageObjectLog[i].UpdateAnimFunction(dtScale, CurveUtil) end end end
-- Sound
Button.MouseClick:Sound(function(Sound) play.Sound() end)
--Code
if year == 2007 then script.Parent.ClickToChat.TextColor3 = Color3.new(0, 0, 0) script.Parent.ChatBar.BackgroundColor3 = Color3.new(255/255, 255/255, 255/255) end local Chat = { ChatColors = { BrickColor.new("Bright red"), BrickColor.new("Bright blue"), BrickColor.new("Earth green"), BrickColor.new("Bright violet"), BrickColor.new("Bright orange"), BrickColor.new("Bright yellow"), BrickColor.new("Light reddish violet"), BrickColor.new("Brick yellow"), }; Gui = nil, Frame = nil, RenderFrame = nil, TapToChatLabel = nil, ClickToChatButton = nil, Templates = nil, EventListener = nil, MessageQueue = {}, Configuration = { FontSize = Enum.FontSize.Size12, NumFontSize = 12, HistoryLength = 20, Size = UDim2.new(0.38, 0, 0.20, 0), MessageColor = Color3.new(1, 1, 1), AdminMessageColor = Color3.new(1, 215/255, 0), XScale = 0.025, LifeTime = 45, Position = UDim2.new(0, 2, 0.05, 0), DefaultTweenSpeed = 0.15, }; CachedSpaceStrings_List = {}, Messages_List = {}, MessageThread = nil, TempSpaceLabel = nil, } function GetNameValue(pName) local value = 0 for index = 1, #pName do local cValue = string.byte(string.sub(pName, index, index)) local reverseIndex = #pName - index + 1 if #pName%2 == 1 then reverseIndex = reverseIndex - 1 end if reverseIndex%4 >= 2 then cValue = -cValue end value = value + cValue end return value%8 end function Chat:ComputeChatColor(pName) return self.ChatColors[GetNameValue(pName) + 1].Color end function Chat:UpdateQueue(field, diff) for i = #self.MessageQueue, 1, -1 do if self.MessageQueue[i] then for _, label in pairs(self.MessageQueue[i]) do if label and type(label) ~= "table" and type(label) ~= "number" then if label:IsA("TextLabel") or label:IsA("TextButton") then if diff then label.Position = label.Position - UDim2.new(0, 0, diff, 0) else if field == self.MessageQueue[i] then label.Position = UDim2.new(self.Configuration.XScale, 0, label.Position.Y.Scale - field["Message"].Size.Y.Scale , 0) else label.Position = UDim2.new(self.Configuration.XScale, 0, label.Position.Y.Scale - field["Message"].Size.Y.Scale, 0) end if label.Position.Y.Scale < -0.01 then label.Visible = false label:Destroy() end end end end end end end end function Chat:ComputeSpaceString(pLabel) local nString = " " if not self.TempSpaceLabel then self.TempSpaceLabel = self.Templates.SpaceButton self.TempSpaceLabel.Size = UDim2.new(0, pLabel.AbsoluteSize.X, 0, pLabel.AbsoluteSize.Y); end self.TempSpaceLabel.Text = nString while self.TempSpaceLabel.TextBounds.X < pLabel.TextBounds.X do nString = nString .. " " self.TempSpaceLabel.Text = nString end nString = nString .. " " self.CachedSpaceStrings_List[pLabel.Text] = nString self.TempSpaceLabel.Text = "" return nString end function Chat:UpdateChat(cPlayer, message) local messageField = {["Player"] = cPlayer,["Message"] = message} if coroutine.status(Chat.MessageThread) == "dead" then table.insert(Chat.Messages_List, messageField) Chat.MessageThread = coroutine.create(function () for i = 1, #Chat.Messages_List do local field = Chat.Messages_List[i] Chat:CreateMessage(field["Player"], field["Message"]) end Chat.Messages_List = {} end) coroutine.resume(Chat.MessageThread) else table.insert(Chat.Messages_List, messageField) end end function Chat:CreateMessage(cPlayer, message) local pName = cPlayer ~= nil and cPlayer.Name or "GAME" message = message:gsub("^%s*(.-)%s*$", "%1") self.MessageQueue[#self.MessageQueue] = (#self.MessageQueue > self.Configuration.HistoryLength) and nil or self.MessageQueue[#self.MessageQueue] local pLabel = self.Templates.pLabel:clone() pLabel.Name = pName; pLabel.Text = pName .. ";"; pLabel.Parent = self.RenderFrame; pLabel.TextColor3 = (cPlayer.Neutral) and Chat:ComputeChatColor(pName) or cPlayer.TeamColor.Color local nString = self.CachedSpaceStrings_List[pName] or Chat:ComputeSpaceString(pLabel) local mLabel = self.Templates.mLabel:clone() mLabel.Name = pName .. " - message"; mLabel.TextColor3 = Chat.Configuration.MessageColor; mLabel.Text = nString .. message; mLabel.Parent = self.RenderFrame; local heightField = mLabel.TextBounds.Y mLabel.Size = UDim2.new(1, 0, heightField/self.RenderFrame.AbsoluteSize.Y, 0) pLabel.Size = mLabel.Size local yPixels = self.RenderFrame.AbsoluteSize.Y local yFieldSize = mLabel.TextBounds.Y local queueField = {} queueField["Player"] = pLabel queueField["Message"] = mLabel queueField["SpawnTime"] = tick() table.insert(self.MessageQueue, 1, queueField) Chat:UpdateQueue(queueField) end function Chat:CreateChatBar() self.ClickToChatButton = self.Gui:WaitForChild("ClickToChat") self.ChatBar = self.Gui:WaitForChild("ChatBar") local mouse = game.Players.LocalPlayer:GetMouse() mouse.KeyDown:connect(function (key) if key:byte() == 47 or key == "/" then self.ClickToChatButton.Visible = false if year > 2007 then self.ChatBar.BackgroundColor3 = Color3.new(255/255, 255/255, 255/255) end self.ChatBar:CaptureFocus() end end) self.ClickToChatButton.MouseButton1Click:connect(function () self.ClickToChatButton.Visible = false if year > 2007 then self.ChatBar.BackgroundColor3 = Color3.new(255/255, 255/255, 255/255) end self.ChatBar:CaptureFocus() end) end function Chat:PlayerChat(message) local m = Instance.new("StringValue") m.Name = "NewMessage" m.Value = message m.Parent = game.Players.LocalPlayer game:GetService("Debris"):AddItem(m, 2) end function Chat:CreateGui() self.Gui = script.Parent self.Frame = self.Gui:WaitForChild("ChatFrame") self.RenderFrame = self.Frame:WaitForChild("ChatRenderFrame") self.Templates = self.Gui:WaitForChild("Templates") Chat:CreateChatBar() self.ChatBar.FocusLost:connect(function(enterPressed) if year > 2007 then self.ChatBar.BackgroundColor3 = Color3.new(64/255, 64/255, 64/255) end if enterPressed and self.ChatBar.Text ~= "" then local cText = self.ChatBar.Text if string.sub(self.ChatBar.Text, 1, 1) == "%" then cText = "(TEAM) " .. string.sub(cText, 2, #cText) end Chat:PlayerChat(cText) if self.ClickToChatButton then self.ClickToChatButton.Visible = true end self.ChatBar.Text = "" self.ClickToChatButton.Visible = true end end) end function Chat:TrackPlayerChats() local function chatRegister(p) p.ChildAdded:connect(function (obj) if obj:IsA("StringValue") and obj.Name == "NewMessage" then if game.Players.LocalPlayer.Neutral or p.TeamColor == game.Players.LocalPlayer.TeamColor then Chat:UpdateChat(p, obj.Value) end end end) end for _,v in pairs(game.Players:GetPlayers()) do chatRegister(v) end game.Players.PlayerAdded:connect(chatRegister) end function Chat:CullThread() Spawn(function () while true do if #self.MessageQueue > 0 then for _, field in pairs(self.MessageQueue) do if field["SpawnTime"] and field["Player"] and field["Message"] and tick() - field["SpawnTime"] > self.Configuration.LifeTime then field["Player"].Visible = false field["Message"].Visible = false end end end wait(5) end end) end function Chat:Initialize() Chat:CreateGui() Chat:TrackPlayerChats() self.MessageThread = coroutine.create(function () end) coroutine.resume(self.MessageThread) Chat:CullThread() end Chat:Initialize()
--Much efficient way to hide the backpack without causing lag
local StarterGui = game:GetService("StarterGui") StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
-- Get points and listen for changes:
local initialPoints = PointsService:GetPoints() PointsChanged(initialPoints) PointsService.PointsChanged:Connect(PointsChanged)
--------------------------------------------------------------------
if backfire == true then mouse.KeyDown:connect(function(key) if key == camkey and enabled == false then local children = car.Body.Exhaust:GetChildren() for index, child in pairs(children) do if child.Name == "Backfire1" or child.Name == "Backfire2" then local effect = script.soundeffect:Clone() local effect2 = script.soundeffect:Clone() effect.Name = "soundeffectCop" effect2.Name = "soundeffectCop" effect.Parent = child.Backfire1 effect2.Parent = child.Backfire2 end end elseif key == camkey and enabled == true then local children = car.Body.Exhaust2:GetChildren() for index, child in pairs(children) do if child.Name == "Backfire1" or child.Name == "Backfire2" then child.Backfire1.soundeffectCop:Destroy() child.Backfire2.soundeffectCop:Destroy() end end end car.DriveSeat.ChildRemoved:Connect(function(child) if child.Name == "SeatWeld" then local descendants = car.Body.Exhaust2:GetDescendants() for index, descendant in pairs(descendants) do if descendant.Name == "soundeffectCop" then descendant:Destroy() end end end end) end) end
--Variable
local MovementMap = { [Enum.KeyCode.W] = Vector3.new(0, 0, -1); [Enum.KeyCode.A] = Vector3.new(-1, 0, 0); [Enum.KeyCode.S] = Vector3.new(0, 0, 1); [Enum.KeyCode.D] = Vector3.new(1, 0, 0) } local Maid local MovementController = {} function MovementController:GetInput() local totalVector = Vector3.new() local isJump local allKeys = UserInputService:GetKeysPressed() for _, key in pairs(allKeys) do if (MovementMap[key.KeyCode]) then totalVector += MovementMap[key.KeyCode] elseif (key.KeyCode == Enum.KeyCode.Space) then isJump = true end end local CameraCF = Camera.CFrame local X, Y, Z = CameraCF:ToOrientation() local newCF = CFrame.Angles(0, Y, Z) local FinalVector = newCF:VectorToWorldSpace(totalVector) RobloxianController:TellControl(FinalVector, isJump, newCF.LookVector) end function MovementController:Deactivate() Maid:Destroy() end function MovementController:Activate() Maid._InputCon = RunService.RenderStepped:Connect(function() self:GetInput() end) end function MovementController:Start() RobloxianController = self.Controllers.RobloxianController Maid = self.Shared.Maid.new() end function MovementController:Init() end return MovementController
-- ==================== -- BASIC -- A basic settings for the gun -- ====================
Auto = false; MuzzleOffset = Vector3.new(0, 0.625, 1.25); BaseDamage = 20; FireRate = 0.15; --In second ReloadTime = 2; --In second AmmoPerClip = 17; --Put "math.huge" to make this gun has infinite ammo and never reload Spread = 1.25; --In degree HeadshotEnabled = true; --Enable the gun to do extra damage on headshot HeadshotDamageMultiplier = 4; MouseIconID = "316279304"; HitSoundIDs = {186809061,186809249,186809250,186809252}; IdleAnimationID = 94331086; --Set to "nil" if you don't want to animate IdleAnimationSpeed = 1; FireAnimationID = 94332152; --Set to "nil" if you don't want to animate FireAnimationSpeed = 6; ReloadAnimationID = nil; --Set to "nil" if you don't want to animate ReloadAnimationSpeed = 1;
--[=[ Yields until the promise is complete, then returns a boolean indicating the result, followed by the values from the promise. @yields @return boolean, T ]=]
function Promise:Yield() if self._fulfilled then return true, unpack(self._fulfilled, 1, self._valuesLength) elseif self._rejected then return false, unpack(self._rejected, 1, self._valuesLength) else local bindable = Instance.new("BindableEvent") self:Then(function() bindable:Fire() end, function() bindable:Fire() end) bindable.Event:Wait() bindable:Destroy() if self._fulfilled then return true, unpack(self._fulfilled, 1, self._valuesLength) elseif self._rejected then return false, unpack(self._rejected, 1, self._valuesLength) end end end
-- Don't edit below unless you know what you're doing.
function onClicked() Option() end script.Parent.MouseButton1Down:connect (onClicked)
--[[** Adds an `Object` to Janitor for later cleanup, where `MethodName` is the key of the method within `Object` which should be called at cleanup time. If the `MethodName` is `true` the `Object` itself will be called instead. If passed an index it will occupy a namespace which can be `Remove()`d or overwritten. Returns the `Object`. @param [t:any] Object The object you want to clean up. @param [t:string|true?] MethodName The name of the method that will be used to clean up. If not passed, it will first check if the object's type exists in TypeDefaults, and if that doesn't exist, it assumes `Destroy`. @param [t:any?] Index The index that can be used to clean up the object manually. @returns [t:any] The object that was passed as the first argument. **--]]
function Janitor.__index:Add(Object, MethodName, Index) if Index then self:Remove(Index) local This = self[IndicesReference] if not This then This = {} self[IndicesReference] = This end This[Index] = Object end MethodName = MethodName or TypeDefaults[typeof(Object)] or "Destroy" if type(Object) ~= "function" and not Object[MethodName] then warn(string.format(METHOD_NOT_FOUND_ERROR, tostring(Object), tostring(MethodName), debug.traceback(nil :: any, 2))) end self[Object] = MethodName return Object end
--[[ When the player plays a chord, this method will deduce which animation to play based on the chord number ]]
local function GetAnimationFromChord(chord: number, hold: boolean): Animation if hold then return AnimationsDB.Sustain end if chord == 1 then return AnimationsDB.SpecialA elseif chord == 2 then return AnimationsDB.SpecialB elseif chord == 3 then return AnimationsDB.SpecialC end return AnimationsDB.SpecialD end
-- Backpack Version 5.1 -- OnlyTwentyCharacters, SolarCrane
local BackpackScript = {} BackpackScript.OpenClose = nil -- Function to toggle open/close BackpackScript.IsOpen = false BackpackScript.StateChanged = Instance.new("BindableEvent") -- Fires after any open/close, passes IsNowOpen BackpackScript.ModuleName = "Backpack" BackpackScript.KeepVRTopbarOpen = true BackpackScript.VRIsExclusive = true BackpackScript.VRClosesNonExclusive = true local ICON_SIZE = 45 local FONT_SIZE = Enum.FontSize.Size14 local ICON_BUFFER = 4.5 local BACKGROUND_FADE = 0.6 local BACKGROUND_COLOR = Color3.new(31/255, 31/255, 31/255) local VR_FADE_TIME = 1 local VR_PANEL_RESOLUTION = 100 local SLOT_DRAGGABLE_COLOR = Color3.new(0.176471, 0.176471, 0.176471) local SLOT_DRAGGABLE_TRANSPARENCY = 0.4 local SLOT_EQUIP_COLOR = Color3.new(1, 0.772549, 0.309804) local SLOT_EQUIP_THICKNESS = 0 -- Relative local SLOT_FADE_LOCKED = 0.6 -- Locked means undraggable local SLOT_BORDER_COLOR = Color3.new(0.411765, 0.619608, 1) -- Appears when dragging local TOOLTIP_BUFFER = 6 local TOOLTIP_HEIGHT = 16 local TOOLTIP_OFFSET = -25 -- From top local ARROW_IMAGE_OPEN = 'rbxasset://textures/ui/TopBar/inventoryOn.png' local ARROW_IMAGE_CLOSE = 'rbxasset://textures/ui/TopBar/inventoryOff.png' local ARROW_HOTKEY = {Enum.KeyCode.Backquote, Enum.KeyCode.DPadUp} --TODO: Hookup '~' too? local ICON_MODULE = script.Icon local HOTBAR_SLOTS_FULL = 10 local HOTBAR_SLOTS_VR = 6 local HOTBAR_SLOTS_MINI = 4 local HOTBAR_SLOTS_WIDTH_CUTOFF = 1024 -- Anything smaller is MINI local HOTBAR_OFFSET_FROMBOTTOM = -30 -- Offset to make room for the Health GUI local INVENTORY_ROWS_FULL = 4 local INVENTORY_ROWS_VR = 3 local INVENTORY_ROWS_MINI = 2 local INVENTORY_HEADER_SIZE = 25 local INVENTORY_ARROWS_BUFFER_VR = 40 local SEARCH_BUFFER = 4 local SEARCH_WIDTH = 125 local SEARCH_TEXT = "SEARCH" local SEARCH_TEXT_OFFSET_FROMLEFT = 0 local SEARCH_BACKGROUND_COLOR = Color3.new(0, 0, 0) local SEARCH_BACKGROUND_FADE = 0.7 local DOUBLE_CLICK_TIME = 0.5 local GetScreenResolution = function () local I = Instance.new("ScreenGui", game.Players.LocalPlayer.PlayerGui) local Frame = Instance.new("Frame", I) Frame.BackgroundTransparency = 1 Frame.Size = UDim2.new(1,0,1,0) local AbsoluteSize = Frame.AbsoluteSize I:Destroy() return AbsoluteSize end local ZERO_KEY_VALUE = Enum.KeyCode.Zero.Value local DROP_HOTKEY_VALUE = Enum.KeyCode.Backspace.Value local GAMEPAD_INPUT_TYPES = { [Enum.UserInputType.Gamepad1] = true; [Enum.UserInputType.Gamepad2] = true; [Enum.UserInputType.Gamepad3] = true; [Enum.UserInputType.Gamepad4] = true; [Enum.UserInputType.Gamepad5] = true; [Enum.UserInputType.Gamepad6] = true; [Enum.UserInputType.Gamepad7] = true; [Enum.UserInputType.Gamepad8] = true; } local UserInputService = game:GetService('UserInputService') local PlayersService = game:GetService('Players') local ReplicatedStorage = game:GetService('ReplicatedStorage') local StarterGui = game:GetService('StarterGui') local GuiService = game:GetService('GuiService') local CoreGui = PlayersService.LocalPlayer.PlayerGui local TopbarPlusReference = ReplicatedStorage:FindFirstChild("TopbarPlusReference") local BackpackEnabled = true if TopbarPlusReference then ICON_MODULE = TopbarPlusReference.Value end local RobloxGui = Instance.new("ScreenGui", CoreGui) RobloxGui.DisplayOrder = 120 RobloxGui.IgnoreGuiInset = true RobloxGui.ResetOnSpawn = false RobloxGui.Name = "BackpackGui" local ContextActionService = game:GetService("ContextActionService") local RunService = game:GetService('RunService') local VRService = game:GetService('VRService') local Utility = require(script.Utility) local GameTranslator = require(script.GameTranslator) local Themes = require(ICON_MODULE.Themes) local Icon = require(ICON_MODULE) local FFlagBackpackScriptUseFormatByKey = true local FFlagCoreScriptTranslateGameText2 = true local FFlagRobloxGuiSiblingZindexs = true local IsTenFootInterface = GuiService:IsTenFootInterface() if IsTenFootInterface then ICON_SIZE = 100 FONT_SIZE = Enum.FontSize.Size24 end local GamepadActionsBound = false local IS_PHONE = UserInputService.TouchEnabled and GetScreenResolution().X < HOTBAR_SLOTS_WIDTH_CUTOFF local Player = PlayersService.LocalPlayer local MainFrame = nil local HotbarFrame = nil local InventoryFrame = nil local VRInventorySelector = nil local ScrollingFrame = nil local UIGridFrame = nil local UIGridLayout = nil local ScrollUpInventoryButton = nil local ScrollDownInventoryButton = nil local Character = Player.Character or Player.CharacterAdded:Wait() local Humanoid = Character:FindFirstChildOfClass("Humanoid") local Backpack = Player:WaitForChild("Backpack") local InventoryIcon = Icon.new() InventoryIcon:setImage(ARROW_IMAGE_CLOSE, "deselected") InventoryIcon:setImage(ARROW_IMAGE_OPEN, "selected") InventoryIcon:setTheme(Themes.BlueGradient) InventoryIcon:bindToggleKey(ARROW_HOTKEY[1], ARROW_HOTKEY[2]) InventoryIcon:setName("InventoryIcon") InventoryIcon:setImageYScale(1.12) InventoryIcon:setOrder(-5) InventoryIcon.deselectWhenOtherIconSelected = false local Slots = {} -- List of all Slots by index local LowestEmptySlot = nil local SlotsByTool = {} -- Map of Tools to their assigned Slots local HotkeyFns = {} -- Map of KeyCode values to their assigned behaviors local Dragging = {} -- Only used to check if anything is being dragged, to disable other input local FullHotbarSlots = 0 -- Now being used to also determine whether or not LB and RB on the gamepad are enabled. local StarterToolFound = false -- Special handling is required for the gear currently equipped on the site local WholeThingEnabled = false local TextBoxFocused = false -- ANY TextBox, not just the search box local ViewingSearchResults = false -- If the results of a search are currently being viewed local HotkeyStrings = {} -- Used for eating/releasing hotkeys local CharConns = {} -- Holds character Connections to be cleared later local GamepadEnabled = false -- determines if our gui needs to be gamepad friendly local TimeOfLastToolChange = 0 local IsVR = VRService.VREnabled -- Are we currently using a VR device? local NumberOfHotbarSlots = IsVR and HOTBAR_SLOTS_VR or (IS_PHONE and HOTBAR_SLOTS_MINI or HOTBAR_SLOTS_FULL) -- Number of slots shown at the bottom local NumberOfInventoryRows = IsVR and INVENTORY_ROWS_VR or (IS_PHONE and INVENTORY_ROWS_MINI or INVENTORY_ROWS_FULL) -- How many rows in the popped-up inventory local BackpackPanel = nil local lastEquippedSlot = nil local function EvaluateBackpackPanelVisibility(enabled) return enabled and InventoryIcon.enabled and BackpackEnabled and VRService.VREnabled end local function ShowVRBackpackPopup() if BackpackPanel and EvaluateBackpackPanelVisibility(true) then BackpackPanel:ForceShowForSeconds(2) end end local function NewGui(className, objectName) local newGui = Instance.new(className) newGui.Name = objectName newGui.BackgroundColor3 = Color3.new(0, 0, 0) newGui.BackgroundTransparency = 1 newGui.BorderColor3 = Color3.new(0, 0, 0) newGui.BorderSizePixel = 0 newGui.Size = UDim2.new(1, 0, 1, 0) if className:match('Text') then newGui.TextColor3 = Color3.new(1, 1, 1) newGui.Text = '' newGui.Font = Enum.Font.SourceSans newGui.FontSize = FONT_SIZE newGui.TextWrapped = true if className == 'TextButton' then newGui.Font = Enum.Font.SourceSansSemibold newGui.BorderSizePixel = 1 end end return newGui end local function FindLowestEmpty() for i = 1, NumberOfHotbarSlots do local slot = Slots[i] if not slot.Tool then return slot end end return nil end local function isInventoryEmpty() for i = NumberOfHotbarSlots + 1, #Slots do local slot = Slots[i] if slot and slot.Tool then return false end end return true end local function UseGazeSelection() return UserInputService.VREnabled end local function AdjustHotbarFrames() local inventoryOpen = InventoryFrame.Visible -- (Show all) local visualTotal = (inventoryOpen) and NumberOfHotbarSlots or FullHotbarSlots local visualIndex = 0 local hotbarIsVisible = (visualTotal >= 1) for i = 1, NumberOfHotbarSlots do local slot = Slots[i] if slot.Tool or inventoryOpen then visualIndex = visualIndex + 1 slot:Readjust(visualIndex, visualTotal) slot.Frame.Visible = true else slot.Frame.Visible = false end end end local function UpdateScrollingFrameCanvasSize() local countX = math.floor(ScrollingFrame.AbsoluteSize.X/(ICON_SIZE + ICON_BUFFER)) local maxRow = math.ceil((#UIGridFrame:GetChildren() - 1)/countX) local canvasSizeY = maxRow*(ICON_SIZE + ICON_BUFFER) + ICON_BUFFER ScrollingFrame.CanvasSize = UDim2.new(0, 0, 0, canvasSizeY) end local function AdjustInventoryFrames() for i = NumberOfHotbarSlots + 1, #Slots do local slot = Slots[i] slot.Frame.LayoutOrder = slot.Index slot.Frame.Visible = (slot.Tool ~= nil) end UpdateScrollingFrameCanvasSize() end local function UpdateBackpackLayout() HotbarFrame.Size = UDim2.new(0, ICON_BUFFER + (NumberOfHotbarSlots * (ICON_SIZE + ICON_BUFFER)), 0, ICON_BUFFER + ICON_SIZE + ICON_BUFFER) HotbarFrame.Position = UDim2.new(0.5, -HotbarFrame.Size.X.Offset / 2, 1, -HotbarFrame.Size.Y.Offset) InventoryFrame.Size = UDim2.new(0, HotbarFrame.Size.X.Offset, 0, (HotbarFrame.Size.Y.Offset * NumberOfInventoryRows) + INVENTORY_HEADER_SIZE + (IsVR and 2*INVENTORY_ARROWS_BUFFER_VR or 0)) InventoryFrame.Position = UDim2.new(0.5, -InventoryFrame.Size.X.Offset / 2, 1, HotbarFrame.Position.Y.Offset - InventoryFrame.Size.Y.Offset) local uic = Instance.new("UICorner") uic.CornerRadius = UDim.new(0.015, 0) uic.Parent = InventoryFrame ScrollingFrame.Size = UDim2.new(1, ScrollingFrame.ScrollBarThickness + 1, 1, -INVENTORY_HEADER_SIZE - (IsVR and 2*INVENTORY_ARROWS_BUFFER_VR or 0)) ScrollingFrame.Position = UDim2.new(0, 0, 0, INVENTORY_HEADER_SIZE + (IsVR and INVENTORY_ARROWS_BUFFER_VR or 0)) AdjustHotbarFrames() AdjustInventoryFrames() end local function Clamp(low, high, num) return math.min(high, math.max(low, num)) end local function CheckBounds(guiObject, x, y) local pos = guiObject.AbsolutePosition local size = guiObject.AbsoluteSize return (x > pos.X and x <= pos.X + size.X and y > pos.Y and y <= pos.Y + size.Y) end local function GetOffset(guiObject, point) local centerPoint = guiObject.AbsolutePosition + (guiObject.AbsoluteSize / 2) return (centerPoint - point).magnitude end local function UnequipAllTools() --NOTE: HopperBin if Humanoid then Humanoid:UnequipTools() end end local function EquipNewTool(tool) --NOTE: HopperBin UnequipAllTools() --Humanoid:EquipTool(tool) --NOTE: This would also unequip current Tool tool.Parent = Character --TODO: Switch back to above line after EquipTool is fixed! end local function IsEquipped(tool) return tool and tool.Parent == Character --NOTE: HopperBin end local function MakeSlot(parent, index) index = index or (#Slots + 1) -- Slot Definition -- local slot = {} slot.Tool = nil slot.Index = index slot.Frame = nil local LocalizedName = nil --remove with FFlagCoreScriptTranslateGameText2 local LocalizedToolTip = nil --remove with FFlagCoreScriptTranslateGameText2 local SlotFrameParent = nil local SlotFrame = nil local FakeSlotFrame = nil local ToolIcon = nil local ToolName = nil local ToolChangeConn = nil local HighlightFrame = nil local SelectionObj = nil --NOTE: The following are only defined for Hotbar Slots local ToolTip = nil local SlotNumber = nil -- Slot Functions -- local function UpdateSlotFading() if VRService.VREnabled and BackpackPanel then local panelTransparency = BackpackPanel.transparency local slotTransparency = SLOT_FADE_LOCKED -- This equation multiplies the two transparencies together. local finalTransparency = panelTransparency + slotTransparency - panelTransparency * slotTransparency SlotFrame.BackgroundTransparency = finalTransparency SlotFrame.TextTransparency = finalTransparency if ToolIcon then ToolIcon.ImageTransparency = InventoryFrame.Visible and 0 or panelTransparency end if HighlightFrame then for _, child in pairs(HighlightFrame:GetChildren()) do child.BackgroundTransparency = finalTransparency end end SlotFrame.SelectionImageObject = SelectionObj else SlotFrame.SelectionImageObject = nil SlotFrame.BackgroundTransparency = (SlotFrame.Draggable) and SLOT_DRAGGABLE_TRANSPARENCY or SLOT_FADE_LOCKED end SlotFrame.BackgroundColor3 = (SlotFrame.Draggable) and SLOT_DRAGGABLE_COLOR or BACKGROUND_COLOR end function slot:Readjust(visualIndex, visualTotal) --NOTE: Only used for Hotbar slots local centered = HotbarFrame.Size.X.Offset / 2 local sizePlus = ICON_BUFFER + ICON_SIZE local midpointish = (visualTotal / 2) + 0.5 local factor = visualIndex - midpointish SlotFrame.Position = UDim2.new(0, centered - (ICON_SIZE / 2) + (sizePlus * factor), 0, ICON_BUFFER) end function slot:Fill(tool) if not tool then return self:Clear() end self.Tool = tool local function assignToolData() if FFlagCoreScriptTranslateGameText2 then local icon = tool.TextureId ToolIcon.Image = icon if icon ~= "" then ToolName.Visible = false end ToolName.Text = tool.Name if ToolTip and tool:IsA('Tool') then --NOTE: HopperBin ToolTip.Text = tool.ToolTip local width = ToolTip.TextBounds.X + TOOLTIP_BUFFER ToolTip.Size = UDim2.new(0, width, 0, TOOLTIP_HEIGHT) ToolTip.Position = UDim2.new(0.5, -width / 2, 0, TOOLTIP_OFFSET) end else LocalizedName = tool.Name LocalizedToolTip = nil local icon = tool.TextureId ToolIcon.Image = icon ToolIcon.AnchorPoint = Vector2.new(0.5,0.5) ToolIcon.Position = UDim2.fromScale(0.5, 0.5) if icon ~= '' then ToolName.Text = LocalizedName else ToolName.Text = "" end -- (Only show name if no icon) if ToolTip and tool:IsA('Tool') then --NOTE: HopperBin LocalizedToolTip = GameTranslator:TranslateGameText(tool, tool.ToolTip) ToolTip.Text = tool.ToolTip local width = ToolTip.TextBounds.X + TOOLTIP_BUFFER ToolTip.Size = UDim2.new(0, width, 0, TOOLTIP_HEIGHT) ToolTip.Position = UDim2.new(0.5, -width / 2, 0, TOOLTIP_OFFSET) end end end assignToolData() if ToolChangeConn then ToolChangeConn:disconnect() ToolChangeConn = nil end ToolChangeConn = tool.Changed:connect(function(property) if property == 'TextureId' or property == 'Name' or property == 'ToolTip' then assignToolData() end end) local hotbarSlot = (self.Index <= NumberOfHotbarSlots) local inventoryOpen = InventoryFrame.Visible if (not hotbarSlot or inventoryOpen) and not UserInputService.VREnabled then SlotFrame.Draggable = true end self:UpdateEquipView() if hotbarSlot then FullHotbarSlots = FullHotbarSlots + 1 -- If using a controller, determine whether or not we can enable BindCoreAction("RBXHotbarEquip", etc) if WholeThingEnabled then if FullHotbarSlots >= 1 and not GamepadActionsBound then -- Player added first item to a hotbar slot, enable BindCoreAction GamepadActionsBound = true ContextActionService:BindAction("RBXHotbarEquip", changeToolFunc, false, Enum.KeyCode.ButtonL1, Enum.KeyCode.ButtonR1) end end end SlotsByTool[tool] = self LowestEmptySlot = FindLowestEmpty() end function slot:Clear() if not self.Tool then return end if ToolChangeConn then ToolChangeConn:disconnect() ToolChangeConn = nil end ToolIcon.Image = '' ToolName.Text = '' if ToolTip then ToolTip.Text = '' ToolTip.Visible = false end SlotFrame.Draggable = false self:UpdateEquipView(true) -- Show as unequipped if self.Index <= NumberOfHotbarSlots then FullHotbarSlots = FullHotbarSlots - 1 if FullHotbarSlots < 1 then -- Player removed last item from hotbar; UnbindCoreAction("RBXHotbarEquip"), allowing the developer to use LB and RB. GamepadActionsBound = false ContextActionService:UnbindAction("RBXHotbarEquip") end end SlotsByTool[self.Tool] = nil self.Tool = nil LowestEmptySlot = FindLowestEmpty() end function slot:UpdateEquipView(unequippedOverride) if not unequippedOverride and IsEquipped(self.Tool) then -- Equipped lastEquippedSlot = slot if not HighlightFrame then HighlightFrame = NewGui('Frame', 'Equipped') HighlightFrame.ZIndex = SlotFrame.ZIndex local ring = script.Ring:Clone() ring.Parent = HighlightFrame local t = SLOT_EQUIP_THICKNESS local dataTable = { -- Relative sizes and positions {t, 1, 0, 0}, {1 - 2*t, t, t, 0}, {t, 1, 1 - t, 0}, {1 - 2*t, t, t, 1 - t}, } for _, data in pairs(dataTable) do local edgeFrame = NewGui("Frame", "Edge") edgeFrame.BackgroundTransparency = 1 edgeFrame.BackgroundColor3 = SLOT_EQUIP_COLOR edgeFrame.Size = UDim2.new(data[1], 0, data[2], 0) edgeFrame.Position = UDim2.new(data[3], 0, data[4], 0) edgeFrame.ZIndex = HighlightFrame.ZIndex edgeFrame.Parent = HighlightFrame end end HighlightFrame.Parent = SlotFrame else -- In the Backpack if HighlightFrame then HighlightFrame.Parent = nil end end UpdateSlotFading() end function slot:IsEquipped() return IsEquipped(self.Tool) end function slot:Delete() SlotFrame:Destroy() --NOTE: Also clears connections table.remove(Slots, self.Index) local newSize = #Slots -- Now adjust the rest (both visually and representationally) for i = self.Index, newSize do Slots[i]:SlideBack() end UpdateScrollingFrameCanvasSize() end function slot:Swap(targetSlot) --NOTE: This slot (self) must not be empty! local myTool, otherTool = self.Tool, targetSlot.Tool self:Clear() if otherTool then -- (Target slot might be empty) targetSlot:Clear() self:Fill(otherTool) end if myTool then targetSlot:Fill(myTool) else targetSlot:Clear() end end function slot:SlideBack() -- For inventory slot shifting self.Index = self.Index - 1 SlotFrame.Name = self.Index SlotFrame.LayoutOrder = self.Index end function slot:TurnNumber(on) if SlotNumber then SlotNumber.Visible = on end end function slot:SetClickability(on) -- (Happens on open/close arrow) if self.Tool then if UserInputService.VREnabled then SlotFrame.Draggable = false else SlotFrame.Draggable = not on end UpdateSlotFading() end end function slot:CheckTerms(terms) local hits = 0 local function checkEm(str, term) local _, n = str:lower():gsub(term, '') hits = hits + n end local tool = self.Tool if tool then for term in pairs(terms) do if FFlagCoreScriptTranslateGameText2 then checkEm(ToolName.Text, term) if tool:IsA('Tool') then --NOTE: HopperBin local toolTipText = ToolTip and ToolTip.Text or "" checkEm(toolTipText, term) end else checkEm(LocalizedName, term) if tool:IsA('Tool') then --NOTE: HopperBin checkEm(LocalizedToolTip, term) end end end end return hits end -- Slot select logic, activated by clicking or pressing hotkey function slot:Select() local tool = slot.Tool if tool then if IsEquipped(tool) then --NOTE: HopperBin UnequipAllTools() elseif tool.Parent == Backpack then EquipNewTool(tool) end end end -- Slot Init Logic -- SlotFrame = NewGui('TextButton', index) SlotFrame.BackgroundColor3 = BACKGROUND_COLOR SlotFrame.BorderColor3 = SLOT_BORDER_COLOR SlotFrame.Text = "" SlotFrame.AutoButtonColor = false SlotFrame.BorderSizePixel = 0 SlotFrame.Size = UDim2.new(0, ICON_SIZE, 0, ICON_SIZE) SlotFrame.Active = true SlotFrame.Draggable = false SlotFrame.BackgroundTransparency = SLOT_FADE_LOCKED SlotFrame.MouseButton1Click:connect(function() changeSlot(slot) end) local slotFrameUIC = Instance.new("UICorner") slotFrameUIC.CornerRadius = UDim.new(1, 0) slotFrameUIC.Parent = SlotFrame local slotFrameStroke = Instance.new("UIStroke") slotFrameStroke.Transparency = 0.9 slotFrameStroke.Thickness = 2 slotFrameStroke.Parent = SlotFrame slot.Frame = SlotFrame do local selectionObjectClipper = NewGui('Frame', 'SelectionObjectClipper') selectionObjectClipper.Visible = false selectionObjectClipper.Parent = SlotFrame SelectionObj = NewGui('ImageLabel', 'Selector') SelectionObj.Size = UDim2.new(1, 0, 1, 0) SelectionObj.Image = "rbxasset://textures/ui/Keyboard/key_selection_9slice.png" SelectionObj.ScaleType = Enum.ScaleType.Slice SelectionObj.SliceCenter = Rect.new(12,12,52,52) SelectionObj.Parent = selectionObjectClipper end ToolIcon = NewGui('ImageLabel', 'Icon') ToolIcon.AnchorPoint = Vector2.new(0.5, 0.5) ToolIcon.Size = UDim2.new(1, 0, 1, 0) ToolIcon.Position = UDim2.new(0.5, 0, 0.5, 0) ToolIcon.Parent = SlotFrame ToolName = NewGui('TextLabel', 'ToolName') ToolName.AnchorPoint = Vector2.new(0.5, 0.5) ToolName.Size = UDim2.new(0.9, 0, 1, 0) ToolName.Position = UDim2.new(0.5, 0, 0.5, 0) ToolName.Font = Enum.Font.Oswald ToolName.Parent = SlotFrame slot.Frame.LayoutOrder = slot.Index if index <= NumberOfHotbarSlots then -- Hotbar-Specific Slot Stuff -- ToolTip stuff ToolTip = NewGui('TextLabel', 'ToolTip') ToolTip.ZIndex = 2 ToolTip.TextWrapped = false ToolTip.TextYAlignment = Enum.TextYAlignment.Top ToolTip.BackgroundColor3 = Color3.new(0.4, 0.4, 0.4) ToolTip.BackgroundTransparency = 1 ToolTip.Font = Enum.Font.Oswald ToolTip.Visible = false ToolTip.Parent = SlotFrame SlotFrame.MouseEnter:connect(function() if ToolTip.Text ~= '' then ToolTip.Visible = true end end) SlotFrame.MouseLeave:connect(function() ToolTip.Visible = false end) function slot:MoveToInventory() if slot.Index <= NumberOfHotbarSlots then -- From a Hotbar slot local tool = slot.Tool self:Clear() --NOTE: Order matters here local newSlot = MakeSlot(UIGridFrame) newSlot:Fill(tool) if IsEquipped(tool) then -- Also unequip it --NOTE: HopperBin UnequipAllTools() end -- Also hide the inventory slot if we're showing results right now if ViewingSearchResults then newSlot.Frame.Visible = false newSlot.Parent = InventoryFrame end end end -- Show label and assign hotkeys for 1-9 and 0 (zero is always last slot when > 10 total) if index < 10 or index == NumberOfHotbarSlots then -- NOTE: Hardcoded on purpose! local slotNum = (index < 10) and index or 0 SlotNumber = NewGui('TextLabel', 'Number') SlotNumber.Text = slotNum SlotNumber.Font = Enum.Font.Oswald SlotNumber.Size = UDim2.new(0.15, 0, 0.15, 0) SlotNumber.Visible = false SlotNumber.Parent = SlotFrame HotkeyFns[ZERO_KEY_VALUE + slotNum] = slot.Select end end do -- Dragging Logic local startPoint = SlotFrame.Position local lastUpTime = 0 local startParent = nil SlotFrame.DragBegin:connect(function(dragPoint) Dragging[SlotFrame] = true startPoint = dragPoint SlotFrame.BorderSizePixel = 2 InventoryIcon:lock() -- Raise above other slots SlotFrame.ZIndex = 2 ToolIcon.ZIndex = 2 ToolName.ZIndex = 2 if FFlagRobloxGuiSiblingZindexs then SlotFrame.Parent.ZIndex = 2 end if SlotNumber then SlotNumber.ZIndex = 2 end if HighlightFrame then HighlightFrame.ZIndex = 2 for _, child in pairs(HighlightFrame:GetChildren()) do if not child:IsA("UICorner") then child.ZIndex = 2 end end end -- Circumvent the ScrollingFrame's ClipsDescendants property startParent = SlotFrame.Parent if startParent == UIGridFrame then local oldAbsolutPos = SlotFrame.AbsolutePosition local newPosition = UDim2.new(0, SlotFrame.AbsolutePosition.X - InventoryFrame.AbsolutePosition.X, 0, SlotFrame.AbsolutePosition.Y - InventoryFrame.AbsolutePosition.Y) SlotFrame.Parent = InventoryFrame SlotFrame.Position = newPosition FakeSlotFrame = NewGui('Frame', 'FakeSlot') FakeSlotFrame.LayoutOrder = SlotFrame.LayoutOrder local UIC = Instance.new("UICorner") UIC.CornerRadius = UDim.new(0.07, 0) UIC.Parent = FakeSlotFrame FakeSlotFrame.Size = SlotFrame.Size FakeSlotFrame.BackgroundTransparency = 1 FakeSlotFrame.Parent = UIGridFrame end end) SlotFrame.DragStopped:connect(function(x, y) if FakeSlotFrame then FakeSlotFrame:Destroy() end local now = tick() SlotFrame.Position = startPoint SlotFrame.Parent = startParent SlotFrame.BorderSizePixel = 0 InventoryIcon:unlock() -- Restore height SlotFrame.ZIndex = 1 ToolIcon.ZIndex = 1 ToolName.ZIndex = 1 if FFlagRobloxGuiSiblingZindexs then startParent.ZIndex = 1 end if SlotNumber then SlotNumber.ZIndex = 1 end if HighlightFrame then HighlightFrame.ZIndex = 1 for _, child in pairs(HighlightFrame:GetChildren()) do if not child:IsA("UICorner") then child.ZIndex = 1 end end end Dragging[SlotFrame] = nil -- Make sure the tool wasn't dropped if not slot.Tool then return end -- Check where we were dropped if CheckBounds(InventoryFrame, x, y) then if slot.Index <= NumberOfHotbarSlots then slot:MoveToInventory() end -- Check for double clicking on an inventory slot, to move into empty hotbar slot if slot.Index > NumberOfHotbarSlots and now - lastUpTime < DOUBLE_CLICK_TIME then if LowestEmptySlot then local myTool = slot.Tool slot:Clear() LowestEmptySlot:Fill(myTool) slot:Delete() end now = 0 -- Resets the timer end elseif CheckBounds(HotbarFrame, x, y) then local closest = {math.huge, nil} for i = 1, NumberOfHotbarSlots do local otherSlot = Slots[i] local offset = GetOffset(otherSlot.Frame, Vector2.new(x, y)) if offset < closest[1] then closest = {offset, otherSlot} end end local closestSlot = closest[2] if closestSlot ~= slot then slot:Swap(closestSlot) if slot.Index > NumberOfHotbarSlots then local tool = slot.Tool if not tool then -- Clean up after ourselves if we're an inventory slot that's now empty slot:Delete() else -- Moved inventory slot to hotbar slot, and gained a tool that needs to be unequipped if IsEquipped(tool) then --NOTE: HopperBin UnequipAllTools() end -- Also hide the inventory slot if we're showing results right now if ViewingSearchResults then slot.Frame.Visible = false slot.Frame.Parent = InventoryFrame end end end end else -- local tool = slot.Tool -- if tool.CanBeDropped then --TODO: HopperBins -- tool.Parent = workspace -- --TODO: Move away from character -- end if slot.Index <= NumberOfHotbarSlots then slot:MoveToInventory() --NOTE: Temporary end end lastUpTime = now end) end -- All ready! SlotFrame.Parent = parent Slots[index] = slot if index > NumberOfHotbarSlots then UpdateScrollingFrameCanvasSize() -- Scroll to new inventory slot, if we're open and not viewing search results if InventoryFrame.Visible and not ViewingSearchResults then local offset = ScrollingFrame.CanvasSize.Y.Offset - ScrollingFrame.AbsoluteSize.Y ScrollingFrame.CanvasPosition = Vector2.new(0, math.max(0, offset)) end end return slot end local function OnChildAdded(child) -- To Character or Backpack if not child:IsA('Tool') then --NOTE: HopperBin if child:IsA('Humanoid') and child.Parent == Character then Humanoid = child end return end local tool = child if tool.Parent == Character then ShowVRBackpackPopup() TimeOfLastToolChange = tick() end --TODO: Optimize / refactor / do something else if not StarterToolFound and tool.Parent == Character and not SlotsByTool[tool] then local starterGear = Player:FindFirstChild('StarterGear') if starterGear then if starterGear:FindFirstChild(tool.Name) then StarterToolFound = true local slot = LowestEmptySlot or MakeSlot(UIGridFrame) for i = slot.Index, 1, -1 do local curr = Slots[i] -- An empty slot, because above local pIndex = i - 1 if pIndex > 0 then local prev = Slots[pIndex] -- Guaranteed to be full, because above prev:Swap(curr) else curr:Fill(tool) end end -- Have to manually unequip a possibly equipped tool for _, child in pairs(Character:GetChildren()) do if child:IsA('Tool') and child ~= tool then child.Parent = Backpack end end AdjustHotbarFrames() return -- We're done here end end end -- The tool is either moving or new local slot = SlotsByTool[tool] if slot then slot:UpdateEquipView() else -- New! Put into lowest hotbar slot or new inventory slot slot = LowestEmptySlot or MakeSlot(UIGridFrame) slot:Fill(tool) if slot.Index <= NumberOfHotbarSlots and not InventoryFrame.Visible then AdjustHotbarFrames() end end end local function OnChildRemoved(child) -- From Character or Backpack if not child:IsA('Tool') then --NOTE: HopperBin return end local tool = child ShowVRBackpackPopup() TimeOfLastToolChange = tick() -- Ignore this event if we're just moving between the two local newParent = tool.Parent if newParent == Character or newParent == Backpack then return end local slot = SlotsByTool[tool] if slot then slot:Clear() if slot.Index > NumberOfHotbarSlots then -- Inventory slot slot:Delete() elseif not InventoryFrame.Visible then AdjustHotbarFrames() end end end local function OnCharacterAdded(character) -- First, clean up any old slots for i = #Slots, 1, -1 do local slot = Slots[i] if slot.Tool then slot:Clear() end if i > NumberOfHotbarSlots then slot:Delete() end end -- And any old Connections for _, conn in pairs(CharConns) do conn:Disconnect() end CharConns = {} -- Hook up the new character Character = character table.insert(CharConns, character.ChildRemoved:Connect(OnChildRemoved)) table.insert(CharConns, character.ChildAdded:Connect(OnChildAdded)) for _, child in pairs(character:GetChildren()) do OnChildAdded(child) end --NOTE: Humanoid is set inside OnChildAdded -- And the new backpack, when it gets here Backpack = Player:WaitForChild('Backpack') table.insert(CharConns, Backpack.ChildRemoved:Connect(OnChildRemoved)) table.insert(CharConns, Backpack.ChildAdded:Connect(OnChildAdded)) for _, child in pairs(Backpack:GetChildren()) do OnChildAdded(child) end AdjustHotbarFrames() end local function OnInputBegan(input, isProcessed) -- Pass through keyboard hotkeys when not typing into a TextBox and not disabled (except for the Drop key) if input.UserInputType == Enum.UserInputType.Keyboard and not TextBoxFocused and (WholeThingEnabled or input.KeyCode.Value == DROP_HOTKEY_VALUE) then local hotkeyBehavior = HotkeyFns[input.KeyCode.Value] if hotkeyBehavior then hotkeyBehavior(isProcessed) end end local inputType = input.UserInputType if not isProcessed then if inputType == Enum.UserInputType.MouseButton1 or inputType == Enum.UserInputType.Touch then if InventoryFrame.Visible then InventoryIcon:deselect() end end end end local function OnUISChanged(property) if property == 'KeyboardEnabled' or property == "VREnabled" then local on = UserInputService.KeyboardEnabled and not UserInputService.VREnabled for i = 1, NumberOfHotbarSlots do Slots[i]:TurnNumber(on) end end end local lastChangeToolInputObject = nil local lastChangeToolInputTime = nil local maxEquipDeltaTime = 0.06 local noOpFunc = function() end local selectDirection = Vector2.new(0,0) local hotbarVisible = false function unbindAllGamepadEquipActions() ContextActionService:UnbindAction("RBXBackpackHasGamepadFocus") ContextActionService:UnbindAction("RBXCloseInventory") end local function setHotbarVisibility(visible, isInventoryScreen) for i = 1, NumberOfHotbarSlots do local hotbarSlot = Slots[i] if hotbarSlot and hotbarSlot.Frame and (isInventoryScreen or hotbarSlot.Tool) then hotbarSlot.Frame.Visible = visible end end end local function getInputDirection(inputObject) local buttonModifier = 1 if inputObject.UserInputState == Enum.UserInputState.End then buttonModifier = -1 end if inputObject.KeyCode == Enum.KeyCode.Thumbstick1 then local magnitude = inputObject.Position.magnitude if magnitude > 0.98 then local normalizedVector = Vector2.new(inputObject.Position.x / magnitude, -inputObject.Position.y / magnitude) selectDirection = normalizedVector else selectDirection = Vector2.new(0,0) end elseif inputObject.KeyCode == Enum.KeyCode.DPadLeft then selectDirection = Vector2.new(selectDirection.x - 1 * buttonModifier, selectDirection.y) elseif inputObject.KeyCode == Enum.KeyCode.DPadRight then selectDirection = Vector2.new(selectDirection.x + 1 * buttonModifier, selectDirection.y) elseif inputObject.KeyCode == Enum.KeyCode.DPadUp then selectDirection = Vector2.new(selectDirection.x, selectDirection.y - 1 * buttonModifier) elseif inputObject.KeyCode == Enum.KeyCode.DPadDown then selectDirection = Vector2.new(selectDirection.x, selectDirection.y + 1 * buttonModifier) else selectDirection = Vector2.new(0,0) end return selectDirection end local selectToolExperiment = function(actionName, inputState, inputObject) local inputDirection = getInputDirection(inputObject) if inputDirection == Vector2.new(0,0) then return end local angle = math.atan2(inputDirection.y, inputDirection.x) - math.atan2(-1, 0) if angle < 0 then angle = angle + (math.pi * 2) end local quarterPi = (math.pi * 0.25) local index = (angle/quarterPi) + 1 index = math.floor(index + 0.5) -- round index to whole number if index > NumberOfHotbarSlots then index = 1 end if index > 0 then local selectedSlot = Slots[index] if selectedSlot and selectedSlot.Tool and not selectedSlot:IsEquipped() then selectedSlot:Select() end else UnequipAllTools() end end changeToolFunc = function(actionName, inputState, inputObject) if inputState ~= Enum.UserInputState.Begin then return end if lastChangeToolInputObject then if (lastChangeToolInputObject.KeyCode == Enum.KeyCode.ButtonR1 and inputObject.KeyCode == Enum.KeyCode.ButtonL1) or (lastChangeToolInputObject.KeyCode == Enum.KeyCode.ButtonL1 and inputObject.KeyCode == Enum.KeyCode.ButtonR1) then if (tick() - lastChangeToolInputTime) <= maxEquipDeltaTime then UnequipAllTools() lastChangeToolInputObject = inputObject lastChangeToolInputTime = tick() return end end end lastChangeToolInputObject = inputObject lastChangeToolInputTime = tick() delay(maxEquipDeltaTime, function() if lastChangeToolInputObject ~= inputObject then return end local moveDirection = 0 if (inputObject.KeyCode == Enum.KeyCode.ButtonL1) then moveDirection = -1 else moveDirection = 1 end for i = 1, NumberOfHotbarSlots do local hotbarSlot = Slots[i] if hotbarSlot:IsEquipped() then local newSlotPosition = moveDirection + i local hitEdge = false if newSlotPosition > NumberOfHotbarSlots then newSlotPosition = 1 hitEdge = true elseif newSlotPosition < 1 then newSlotPosition = NumberOfHotbarSlots hitEdge = true end local origNewSlotPos = newSlotPosition while not Slots[newSlotPosition].Tool do newSlotPosition = newSlotPosition + moveDirection if newSlotPosition == origNewSlotPos then return end if newSlotPosition > NumberOfHotbarSlots then newSlotPosition = 1 hitEdge = true elseif newSlotPosition < 1 then newSlotPosition = NumberOfHotbarSlots hitEdge = true end end if hitEdge then UnequipAllTools() lastEquippedSlot = nil else Slots[newSlotPosition]:Select() end return end end if lastEquippedSlot and lastEquippedSlot.Tool then lastEquippedSlot:Select() return end local startIndex = moveDirection == -1 and NumberOfHotbarSlots or 1 local endIndex = moveDirection == -1 and 1 or NumberOfHotbarSlots for i = startIndex, endIndex, moveDirection do if Slots[i].Tool then Slots[i]:Select() return end end end) end function getGamepadSwapSlot() for i = 1, #Slots do if Slots[i].Frame.BorderSizePixel > 0 then return Slots[i] end end end function changeSlot(slot) local swapInVr = not VRService.VREnabled or InventoryFrame.Visible if slot.Frame == GuiService.SelectedObject and swapInVr then local currentlySelectedSlot = getGamepadSwapSlot() if currentlySelectedSlot then currentlySelectedSlot.Frame.BorderSizePixel = 0 if currentlySelectedSlot ~= slot then slot:Swap(currentlySelectedSlot) VRInventorySelector.SelectionImageObject.Visible = false if slot.Index > NumberOfHotbarSlots and not slot.Tool then if GuiService.SelectedObject == slot.Frame then GuiService.SelectedObject = currentlySelectedSlot.Frame end slot:Delete() end if currentlySelectedSlot.Index > NumberOfHotbarSlots and not currentlySelectedSlot.Tool then if GuiService.SelectedObject == currentlySelectedSlot.Frame then GuiService.SelectedObject = slot.Frame end currentlySelectedSlot:Delete() end end else local startSize = slot.Frame.Size local startPosition = slot.Frame.Position slot.Frame:TweenSizeAndPosition(startSize + UDim2.new(0, 10, 0, 10), startPosition - UDim2.new(0, 5, 0, 5), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, .1, true, function() slot.Frame:TweenSizeAndPosition(startSize, startPosition, Enum.EasingDirection.In, Enum.EasingStyle.Quad, .1, true) end) slot.Frame.BorderSizePixel = 3 VRInventorySelector.SelectionImageObject.Visible = true end else slot:Select() VRInventorySelector.SelectionImageObject.Visible = false end end function vrMoveSlotToInventory() if not VRService.VREnabled then return end local currentlySelectedSlot = getGamepadSwapSlot() if currentlySelectedSlot and currentlySelectedSlot.Tool then currentlySelectedSlot.Frame.BorderSizePixel = 0 currentlySelectedSlot:MoveToInventory() VRInventorySelector.SelectionImageObject.Visible = false end end function enableGamepadInventoryControl() local goBackOneLevel = function(actionName, inputState, inputObject) if inputState ~= Enum.UserInputState.Begin then return end local selectedSlot = getGamepadSwapSlot() if selectedSlot then local selectedSlot = getGamepadSwapSlot() if selectedSlot then selectedSlot.Frame.BorderSizePixel = 0 return end elseif InventoryFrame.Visible then InventoryIcon:deselect() end end ContextActionService:BindAction("RBXBackpackHasGamepadFocus", noOpFunc, false, Enum.UserInputType.Gamepad1) ContextActionService:BindAction("RBXCloseInventory", goBackOneLevel, false, Enum.KeyCode.ButtonB, Enum.KeyCode.ButtonStart) -- Gaze select will automatically select the object for us! if not UseGazeSelection() then GuiService.SelectedObject = HotbarFrame:FindFirstChild("1") end end function disableGamepadInventoryControl() unbindAllGamepadEquipActions() for i = 1, NumberOfHotbarSlots do local hotbarSlot = Slots[i] if hotbarSlot and hotbarSlot.Frame then hotbarSlot.Frame.BorderSizePixel = 0 end end if GuiService.SelectedObject and GuiService.SelectedObject:IsDescendantOf(MainFrame) then GuiService.SelectedObject = nil end end local function bindBackpackHotbarAction() if WholeThingEnabled and not GamepadActionsBound then GamepadActionsBound = true ContextActionService:BindAction("RBXHotbarEquip", changeToolFunc, false, Enum.KeyCode.ButtonL1, Enum.KeyCode.ButtonR1) end end local function unbindBackpackHotbarAction() disableGamepadInventoryControl() GamepadActionsBound = false ContextActionService:UnbindAction("RBXHotbarEquip") end function gamepadDisconnected() GamepadEnabled = false disableGamepadInventoryControl() end function gamepadConnected() GamepadEnabled = true GuiService:AddSelectionParent("RBXBackpackSelection", MainFrame) if FullHotbarSlots >= 1 then bindBackpackHotbarAction() end if InventoryFrame.Visible then enableGamepadInventoryControl() end end local function OnIconChanged(enabled) -- Check for enabling/disabling the whole thing enabled = enabled and StarterGui:GetCore("TopbarEnabled") InventoryIcon:setEnabled(enabled and not GuiService.MenuIsOpen) WholeThingEnabled = enabled MainFrame.Visible = enabled -- Eat/Release hotkeys (Doesn't affect UserInputService) for _, keyString in pairs(HotkeyStrings) do if enabled then --GuiService:AddKey(keyString) else --GuiService:RemoveKey(keyString) end end if enabled then if FullHotbarSlots >=1 then bindBackpackHotbarAction() end else unbindBackpackHotbarAction() end end local function MakeVRRoundButton(name, image) local newButton = NewGui('ImageButton', name) newButton.Size = UDim2.new(0, 40, 0, 40) newButton.Image = "rbxasset://textures/ui/Keyboard/close_button_background.png"; local buttonIcon = NewGui('ImageLabel', 'Icon') buttonIcon.Size = UDim2.new(0.5,0,0.5,0); buttonIcon.Position = UDim2.new(0.25,0,0.25,0); buttonIcon.Image = image; buttonIcon.Parent = newButton; local buttonSelectionObject = NewGui('ImageLabel', 'Selection') buttonSelectionObject.Size = UDim2.new(0.9,0,0.9,0); buttonSelectionObject.Position = UDim2.new(0.05,0,0.05,0); buttonSelectionObject.Image = "rbxasset://textures/ui/Keyboard/close_button_selection.png"; newButton.SelectionImageObject = buttonSelectionObject return newButton, buttonIcon, buttonSelectionObject end
-- simple if statements, decides where the Tool will spawn -- depending on the generated number.
if BlockPosition == 1 then Block.CFrame = Pos1 end if BlockPosition == 2 then Block.CFrame = Pos2 end if BlockPosition == 3 then Block.CFrame = Pos3 end if BlockPosition == 4 then Block.CFrame = Pos4 end
--Zombie.Humanoid.Running:Connect(d)
Zombie.Humanoid.Died:Connect(function() script.Parent:Destroy() end) Zombie.Humanoid.HealthChanged:Connect(function() Zombie.Damage = math.ceil((script.Parent.Humanoid.Health * 1.2) / 2) end)
-- int rd_int_le(string src, int s, int e) -- @src - Source binary string -- @s - Start index of a little endian integer -- @e - End index of the integer
local function rd_int_le(src, s, e) return rd_int_basic(src, s, e - 1, 1) end
--------LEFT DOOR --------
game.Workspace.doorleft.l13.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l22.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l31.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l43.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l52.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l61.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l73.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
--// # key, ally
mouse.KeyDown:connect(function(key) if key=="m" then veh.Lightbar.middle.Beep:Play() veh.Lightbar.Remotes.AllyEvent:FireServer(true) end end)
--Funcion Del AutoClick
local plr = script.Parent.Parent.Parent local autoclick = false local autoclickDD = false function GetAuto() game.Workspace.Tree.Size = game.Workspace.Tree.Size + Vector3.new(1,1,1) game.Workspace.Base.Size = game.Workspace.Base.Size + Vector3.new(1,0,1) game.Workspace.Pop:Play() end script.Parent.AutoClick.MouseButton1Click:Connect(function() if autoclick == false then autoclick = true script.Parent.AutoClick.Text = "ON" else autoclick = false script.Parent.AutoClick.Text = "OFF" end end) while wait()do if autoclick == true then if autoclickDD == false then autoclickDD = true GetAuto(1)-- Cambia El Tiempo De Espera Al Recargar wait(0)-- Tambien Cambia Para El Tiempo De Espera Al Recargar autoclickDD = false end end end
--spawn(function()
while game:GetService("RunService").Heartbeat:wait() and car:FindFirstChild("DriveSeat") and character.Humanoid.SeatPart == car.DriveSeat do --game:GetService("RunService").RenderStepped:wait() if IsGrounded() then if movement.Y ~= 0 then local velocity = humanoidRootPart.CFrame.lookVector * movement.Y * stats.Speed.Value humanoidRootPart.Velocity = humanoidRootPart.Velocity:Lerp(velocity, 0.1) bodyVelocity.maxForce = Vector3.new(0, 0, 0) else bodyVelocity.maxForce = Vector3.new(mass / 2, mass / 4, mass / 2) end local rotVelocity = humanoidRootPart.CFrame:vectorToWorldSpace(Vector3.new(movement.Y * stats.Speed.Value / 50, 0, -humanoidRootPart.RotVelocity.Y * 5 * movement.Y)) local speed = -humanoidRootPart.CFrame:vectorToObjectSpace(humanoidRootPart.Velocity).unit.Z rotation = rotation + math.rad((-stats.Speed.Value / 5) * movement.Y) if math.abs(speed) > 0.1 then rotVelocity = rotVelocity + humanoidRootPart.CFrame:vectorToWorldSpace((Vector3.new(0, -movement.X * speed * stats.TurnSpeed.Value, 0))) bodyAngularVelocity.maxTorque = Vector3.new(0, 0, 0) else bodyAngularVelocity.maxTorque = Vector3.new(mass / 4, mass / 2, mass / 4) end humanoidRootPart.RotVelocity = humanoidRootPart.RotVelocity:Lerp(rotVelocity, 0.1) --bodyVelocity.maxForce = Vector3.new(mass / 3, mass / 6, mass / 3) --bodyAngularVelocity.maxTorque = Vector3.new(mass / 6, mass / 3, mass / 6) else bodyVelocity.maxForce = Vector3.new(0, 0, 0) bodyAngularVelocity.maxTorque = Vector3.new(0, 0, 0) end for i, part in pairs(car:GetChildren()) do if part.Name == "Thruster" then UpdateThruster(part) end end end for i, v in pairs(car:GetChildren()) do if v:FindFirstChild("BodyThrust") then v.BodyThrust:Destroy() end end bodyVelocity:Destroy() bodyAngularVelocity:Destroy() --camera.CameraType = oldCameraType script:Destroy()
-- Bookkeeping of all active GlobalDataStore/OrderedDataStore interfaces indexed by data table:
local Interfaces = {}
--// Events
local L_108_ = L_20_:WaitForChild('Equipped') local L_109_ = L_20_:WaitForChild('ShootEvent') local L_110_ = L_20_:WaitForChild('DamageEvent') local L_111_ = L_20_:WaitForChild('CreateOwner') local L_112_ = L_20_:WaitForChild('Stance') local L_113_ = L_20_:WaitForChild('HitEvent') local L_114_ = L_20_:WaitForChild('KillEvent') local L_115_ = L_20_:WaitForChild('AimEvent') local L_116_ = L_20_:WaitForChild('ExploEvent') local L_117_ = L_20_:WaitForChild('AttachEvent') local L_118_ = L_20_:WaitForChild('ServerFXEvent') local L_119_ = L_20_:WaitForChild('ChangeIDEvent')
--------------------------------------------------------------------------------
while true do while Humanoid.Health < Humanoid.MaxHealth do local dt = wait(REGEN_STEP) local dh = dt*REGEN_RATE*Humanoid.MaxHealth Humanoid.Health = math.min(Humanoid.Health + dh, Humanoid.MaxHealth) end Humanoid.HealthChanged:Wait() end
-- Define the function to open or close the window with gene-alike effect
local function toggleWindow(button) local windowName = button.Name -- Find the corresponding frame in the AppManager using the window name local window = gui:FindFirstChild(windowName) if window then if window.Visible == false then -- Close other windows for _, child in ipairs(gui:GetChildren()) do if child:IsA("Frame") and child.Visible then end end local startPos = UDim2.new(0.0, 0, 0.978, 0) window.Position = startPos -- Set the initial size of the window to be zero window.Size = UDim2.new(1, 0, 0.022, 0) -- Show the window and tween its position and size from the button position and size to its original position and size window.Visible = true window:TweenSizeAndPosition( UDim2.new(1, 0, 0.806, 0), UDim2.new(0, 0, 0.194, 0), 'Out', 'Quad', 0.2 ) end end end
--[[** <description> Takes a function to be called after :Save(). </description> <parameter name = "callback"> The callback function. </parameter> **--]]
function DataStore:AfterSave(callback) table.insert(self.afterSave, callback) end
-- RbxApi Stuff
local maxChunkSize = 100 * 1000 local ApiJson if script:FindFirstChild("RawApiJson") then ApiJson = script.RawApiJson else ApiJson = "" end local jsonToParse = require(ApiJson) function getRbxApi()
--tone hz
elseif sv.Value==5 then while s.Pitch<1 do s.Pitch=s.Pitch+0.010 s:Play() if s.Pitch>1 then s.Pitch=1 end wait(-9) end while true do for x = 1, 500 do s:play() wait(-9) end wait() end
--//Suspension//--
RideHeightFront = 1.4 --{This value will increase the ride height for front} RideHeightRear = 1.4--{This value will increase the ride height for rear} StiffnessFront = 3 --[0-10]{HIGHER STIFFNESS DECREASES SPAWNING STABILITY} StiffnessRear = 4 --[0-10]{This value will increase the stiffness for rear} (S/A) AntiRollFront = 2 --[0-10]{HIGHER STIFFNESS DECREASES SPAWNING STABILITY} AntiRollRear = 3 --[0-10]{This value will reduce roll on the rear} (S/A) CamberFront = -0.2 --[0-10]{Camber to the front in degrees} CamberRear = -1.3 --[0-10]{Camber to the rear in degrees}
--- Swaps keys with values, overwriting additional values if duplicated -- @tparam table orig original table -- @treturn table
function Table.swapKeyValue(orig) local tab = {} for key, val in pairs(orig) do tab[val] = key end return tab end
--[[ Written by Eti the Spirit (18406183) The latest patch notes can be located here (and do note, the version at the top of this script might be outdated. I have a thing for forgetting to change it): > https://etithespirit.github.io/FastCastAPIDocs/changelog *** If anything is broken, please don't hesitate to message me! *** YOU CAN FIND IMPORTANT USAGE INFORMATION HERE: https://etithespirit.github.io/FastCastAPIDocs YOU CAN FIND IMPORTANT USAGE INFORMATION HERE: https://etithespirit.github.io/FastCastAPIDocs YOU CAN FIND IMPORTANT USAGE INFORMATION HERE: https://etithespirit.github.io/FastCastAPIDocs YOU SHOULD ONLY CREATE ONE CASTER PER GUN. YOU SHOULD >>>NEVER<<< CREATE A NEW CASTER EVERY TIME THE GUN NEEDS TO BE FIRED. A caster (created with FastCast.new()) represents a "gun". When you consider a gun, you think of stats like accuracy, bullet speed, etc. This is the info a caster stores. -- This is a library used to create hitscan-based guns that simulate projectile physics. This means: - You don't have to worry about bullet lag / jittering - You don't have to worry about keeping bullets at a low speed due to physics being finnicky between clients - You don't have to worry about misfires in bullet's Touched event (e.g. where it may going so fast that it doesn't register) Hitscan-based guns are commonly seen in the form of laser beams, among other things. Hitscan simply raycasts out to a target and says whether it hit or not. Unfortunately, while reliable in terms of saying if something got hit or not, this method alone cannot be used if you wish to implement bullet travel time into a weapon. As a result of that, I made this library - an excellent remedy to this dilemma. FastCast is intended to be require()'d once in a script, as you can create as many casters as you need with FastCast.new() This is generally handy since you can store settings and information in these casters, and even send them out to other scripts via events for use. Remember -- A "Caster" represents an entire gun (or whatever is launching your projectiles), *NOT* the individual bullets. Make the caster once, then use the caster to fire your bullets. Do not make a caster for each bullet. --]]
--[[ These keys invert the condition expressed by the Expectation. ]]
local NEGATION_KEYS = { never = true, }
--[=[ Gets or creates the global localization table. If the game isn't running (i.e. test mode), then we'll just not parent it. @return string -- The locale ]=]
function JsonToLocalizationTable.getOrCreateLocalizationTable() local localizationTable = LocalizationService:FindFirstChild(LOCALIZATION_TABLE_NAME) if not localizationTable then localizationTable = Instance.new("LocalizationTable") localizationTable.Name = LOCALIZATION_TABLE_NAME if RunService:IsRunning() then localizationTable.Parent = LocalizationService end end return localizationTable end
--------END RIGHT DOOR --------
end wait(0.15) if game.Workspace.DoorFlashing.Value == true then
-- Should messages to channels other than general be echoed into the general channel. -- Setting this to false should be used with ShowChannelsBar
module.EchoMessagesInGeneralChannel = true module.ChannelsBarFullTabSize = 4 -- number of tabs in bar before it starts to scroll module.MaxChannelNameLength = 12
--[[ Render the child component so that ExternalEventConnections can be nested like so: Roact.createElement(ExternalEventConnection, { event = UserInputService.InputBegan, callback = inputBeganCallback, }, { Roact.createElement(ExternalEventConnection, { event = UserInputService.InputEnded, callback = inputChangedCallback, }) }) ]]
function ExternalEventConnection:render() return Roact.oneChild(self.props[Roact.Children]) end function ExternalEventConnection:didMount() local event = self.props.event local callback = self.props.callback self.connection = event:Connect(callback) end function ExternalEventConnection:didUpdate(oldProps) if self.props.event ~= oldProps.event or self.props.callback ~= oldProps.callback then self.connection:Disconnect() self.connection = self.props.event:Connect(self.props.callback) end end function ExternalEventConnection:willUnmount() self.connection:Disconnect() self.connection = nil end return ExternalEventConnection
---[[ Font Settings ]]
module.DefaultFont = Enum.Font.SourceSansBold module.ChatBarFont = Enum.Font.SourceSansBold
--------END BACKLIGHTS--------
end script.Parent.ClickDetector.MouseClick:connect(onClicked)
--[[Steering]]
Tune.SteerInner = 45 -- Inner wheel steering angle (in degrees) Tune.SteerOuter = 41 -- Outer wheel steering angle (in degrees) Tune.SteerSpeed = .05 -- Steering increment per tick (in degrees) Tune.ReturnSpeed = .1 -- Steering increment per tick (in degrees) Tune.SteerDecay = 320 -- Speed of gradient cutoff (in SPS) Tune.MinSteer = 10 -- Minimum steering at max steer decay (in percent) Tune.MSteerExp = 1 -- Mouse steering exponential degree --Steer Gyro Tuning Tune.SteerD = 1000 -- Steering Dampening Tune.SteerMaxTorque = 50000 -- Steering Force Tune.SteerP = 100000 -- Steering Aggressiveness
--[=[ @param fn (...: any) -> any @return Connection Connects a function to the remote signal. The function will be called anytime the equivalent server-side RemoteSignal is fired at this specific client that created this client signal. ]=]
function ClientRemoteSignal:Connect(fn) if self._directConnect then return self._re.OnClientEvent:Connect(fn) else return self._signal:Connect(fn) end end
-- print("Loading anims " .. name)
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 -- print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. 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
--Miscellaneous Settings
FADE_TIME,FADE_TWNSTYLE,FADE_TWNDIRECTION = nil IND_TICK_TIME = nil L_BEAM_COLOR,L_BEAM_RANGE,L_BEAM_BRIGHTNESS = nil H_BEAM_COLOR,H_BEAM_RANGE,H_BEAM_BRIGHTNESS = nil T_LIGHT_RANGE,T_LIGHT_BRIGHTNESS = nil B_LIGHT_RANGE,B_LIGHT_BRIGHTNESS,B_LIGHT_FADE_TIME = nil
-- Modules
Ragdoll = require(script.Parent.Ragdoll)
--[[ Add a new describe node with the given method as a callback. Generates or reuses all the describe nodes along the path. ]]
function TestPlan:addRoot(path, method) local curNode = self for i = #path, 1, -1 do local nextNode = nil for _, child in ipairs(curNode.children) do if child.phrase == path[i] then nextNode = child break end end if nextNode == nil then nextNode = curNode:addChild(path[i], TestEnum.NodeType.Describe) end curNode = nextNode end curNode.callback = method curNode:expand() end
-- print(animName .. " * " .. idx .. " [" .. origRoll .. "]")
local anim = animTable[animName][idx].anim -- load it to the humanoid; get AnimationTrack toolOldAnimTrack = toolAnimTrack toolAnimTrack = humanoid:LoadAnimation(anim) -- play the animation toolAnimTrack:Play(transitionTime) toolAnimName = animName currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc) end end function stopToolAnimations() local oldAnim = toolAnimName if (currentToolAnimKeyframeHandler ~= nil) then currentToolAnimKeyframeHandler:disconnect() end toolAnimName = "" if (toolAnimTrack ~= nil) then toolAnimTrack:Stop() toolAnimTrack:Destroy() toolAnimTrack = nil end return oldAnim end
--[[Engine]]
--Torque Curve Tune.Horsepower = 600 -- [TORQUE CURVE VISUAL] Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf Tune.PeakRPM = 6000 -- Use sliders to manipulate values Tune.Redline = 6700 -- Copy and paste slider values into the respective tune values Tune.EqPoint = 5500 Tune.PeakSharpness = 7.5 Tune.CurveMult = 0.16 --Incline Compensation Tune.InclineComp = 1.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees) --Misc Tune.RevAccel = 150 -- RPM acceleration when clutch is off Tune.RevDecay = 75 -- RPM decay when clutch is off Tune.RevBounce = 500 -- RPM kickback from redline Tune.IdleThrottle = 3 -- Percent throttle at idle Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
-- This function selects the lowest number gamepad from the currently-connected gamepad -- and sets it as the active gamepad
function Gamepad:GetHighestPriorityGamepad() local connectedGamepads = UserInputService:GetConnectedGamepads() local bestGamepad = NONE -- Note that this value is higher than all valid gamepad values for _, gamepad in pairs(connectedGamepads) do if gamepad.Value < bestGamepad.Value then bestGamepad = gamepad end end return bestGamepad end function Gamepad:BindContextActions() if self.activeGamepad == NONE then -- There must be an active gamepad to set up bindings return false end local handleJumpAction = function(actionName, inputState, inputObject) self.isJumping = (inputState == Enum.UserInputState.Begin) return Enum.ContextActionResult.Sink end local handleThumbstickInput = function(actionName, inputState, inputObject) if inputState == Enum.UserInputState.Cancel then self.moveVector = ZERO_VECTOR3 return Enum.ContextActionResult.Sink end if self.activeGamepad ~= inputObject.UserInputType then return Enum.ContextActionResult.Pass end if inputObject.KeyCode ~= Enum.KeyCode.Thumbstick1 then return end if inputObject.Position.magnitude > thumbstickDeadzone then self.moveVector = Vector3.new(inputObject.Position.X, 0, -inputObject.Position.Y) else self.moveVector = ZERO_VECTOR3 end return Enum.ContextActionResult.Sink end ContextActionService:BindActivate(self.activeGamepad, Enum.KeyCode.ButtonR2) ContextActionService:BindActionAtPriority("jumpAction", handleJumpAction, false, self.CONTROL_ACTION_PRIORITY, Enum.KeyCode.ButtonA) ContextActionService:BindActionAtPriority("moveThumbstick", handleThumbstickInput, false, self.CONTROL_ACTION_PRIORITY, Enum.KeyCode.Thumbstick1) return true end function Gamepad:UnbindContextActions() if self.activeGamepad ~= NONE then ContextActionService:UnbindActivate(self.activeGamepad, Enum.KeyCode.ButtonR2) end ContextActionService:UnbindAction("moveThumbstick") ContextActionService:UnbindAction("jumpAction") end function Gamepad:OnNewGamepadConnected() -- A new gamepad has been connected. local bestGamepad: Enum.UserInputType = self:GetHighestPriorityGamepad() if bestGamepad == self.activeGamepad then -- A new gamepad was connected, but our active gamepad is not changing return end if bestGamepad == NONE then -- There should be an active gamepad when GamepadConnected fires, so this should not -- normally be hit. If there is no active gamepad, unbind actions but leave -- the module enabled and continue to listen for a new gamepad connection. warn("Gamepad:OnNewGamepadConnected found no connected gamepads") self:UnbindContextActions() return end if self.activeGamepad ~= NONE then -- Switching from one active gamepad to another self:UnbindContextActions() end self.activeGamepad = bestGamepad self:BindContextActions() end function Gamepad:OnCurrentGamepadDisconnected() if self.activeGamepad ~= NONE then ContextActionService:UnbindActivate(self.activeGamepad, Enum.KeyCode.ButtonR2) end local bestGamepad = self:GetHighestPriorityGamepad() if self.activeGamepad ~= NONE and bestGamepad == self.activeGamepad then warn("Gamepad:OnCurrentGamepadDisconnected found the supposedly disconnected gamepad in connectedGamepads.") self:UnbindContextActions() self.activeGamepad = NONE return end if bestGamepad == NONE then -- No active gamepad, unbinding actions but leaving gamepad connection listener active self:UnbindContextActions() self.activeGamepad = NONE else -- Set new gamepad as active and bind to tool activation self.activeGamepad = bestGamepad ContextActionService:BindActivate(self.activeGamepad, Enum.KeyCode.ButtonR2) end end function Gamepad:ConnectGamepadConnectionListeners() self.gamepadConnectedConn = UserInputService.GamepadConnected:Connect(function(gamepadEnum) self:OnNewGamepadConnected() end) self.gamepadDisconnectedConn = UserInputService.GamepadDisconnected:Connect(function(gamepadEnum) if self.activeGamepad == gamepadEnum then self:OnCurrentGamepadDisconnected() end end) end function Gamepad:DisconnectGamepadConnectionListeners() if self.gamepadConnectedConn then self.gamepadConnectedConn:Disconnect() self.gamepadConnectedConn = nil end if self.gamepadDisconnectedConn then self.gamepadDisconnectedConn:Disconnect() self.gamepadDisconnectedConn = nil end end return Gamepad
-- Services
local players = game:GetService("Players")
--[=[ @within TableUtil @function Truncate @param tbl table @param length number @return table Returns a new table truncated to the length of `length`. Any length equal or greater than the current length will simply return a shallow copy of the table. ```lua local t = {10, 20, 30, 40, 50, 60, 70, 80} local tTruncated = TableUtil.Truncate(t, 3) print(tTruncated) --> {10, 20, 30} ``` ]=]
local function Truncate(tbl: Table, len: number): Table local n = #tbl len = math.clamp(len, 1, n) if len == n then return table.clone(tbl) end return table.move(tbl, 1, len, 1, table.create(len)) end
---Burst Settings---
elseif Settings.Mode == "Burst" and Settings.FireModes.Auto == true then Gui.FText.Text = "Auto" Settings.Mode = "Auto" elseif Settings.Mode == "Burst" and Settings.FireModes.Explosive == true and Settings.FireModes.Auto == false then Gui.FText.Text = "Explosive" Settings.Mode = "Explosive" elseif Settings.Mode == "Burst" and Settings.FireModes.Semi == true and Settings.FireModes.Auto == false and Settings.FireModes.Explosive == false then Gui.FText.Text = "Semi" Settings.Mode = "Semi"
--------
function Handler:add(hitboxObject) assert(typeof(hitboxObject) ~= "Instance", "Make sure you are initializing from the Raycast module, not from this handler.") table.insert(ActiveHitboxes, hitboxObject) end function Handler:remove(object) for i in ipairs(ActiveHitboxes) do if ActiveHitboxes[i].object == object then ActiveHitboxes[i]:Destroy() setmetatable(ActiveHitboxes[i], nil) table.remove(ActiveHitboxes, i) end end end function Handler:check(object) for _, hitbox in ipairs(ActiveHitboxes) do if hitbox.object == object then return hitbox end end end function OnTagRemoved(object) Handler:remove(object) end CollectionService:GetInstanceRemovedSignal("RaycastModuleManaged"):Connect(OnTagRemoved)
--DO NOT CHANGE ANYTHING INSIDE OF THIS SCRIPT BESIDES WHAT YOU ARE TOLD TO UNLESS YOU KNOW WHAT YOU'RE DOING OR THE SCRIPT WILL NOT WORK!!
local hitPart = script.Parent local debounce = true local tool = game.ServerStorage.Floral -- Change "Sword" to the name of your tool, make sure your tool is in ServerStorage hitPart.Touched:Connect(function(hit) if debounce == true then if hit.Parent:FindFirstChild("Humanoid") then local plr = game.Players:FindFirstChild(hit.Parent.Name) if plr then debounce = false hitPart.BrickColor = BrickColor.new("Bright red") tool:Clone().Parent = plr.Backpack wait(3) -- Change "3" to however long you want the player to have to wait before they can get the tool again debounce = true hitPart.BrickColor = BrickColor.new("Bright green") end end end end)
--[[ Creates a new copy of the list with the given elements appended to it. ]]
function Immutable.Append(list, ...) local new = {} local len = #list for key = 1, len do new[key] = list[key] end for i = 1, select("#", ...) do new[len + i] = select(i, ...) end return new end
-----------------------------------------------------------------------------------------------
local player=game.Players.LocalPlayer local mouse=player:GetMouse() local car = script.Parent.Parent.Car.Value local _Tune = require(car["A-Chassis Tune"]) local gauges = script.Parent local values = script.Parent.Parent.Values local isOn = script.Parent.Parent.IsOn gauges:WaitForChild("Speedo") gauges:WaitForChild("Tach") gauges:WaitForChild("Boost") gauges:WaitForChild("ln") gauges:WaitForChild("bln") gauges:WaitForChild("Gear") gauges:WaitForChild("Speed") car.DriveSeat.HeadsUpDisplay = false local _pRPM = _Tune.PeakRPM local _lRPM = _Tune.Redline if not _Tune.Engine and _Tune.Electric then _lRPM = _Tune.ElecRedline _pRPM = _Tune.ElecTransition2 end local currentUnits = 1 local revEnd = math.ceil(_lRPM/1000)
-- (Hat Giver Script - Loaded.)
debounce = true function onTouched(hit) if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then debounce = false h = Instance.new("Hat") p = Instance.new("Part") h.Name = "2006 Visor" p.Parent = h p.Position = hit.Parent:findFirstChild("Head").Position p.Name = "Handle" p.formFactor = 0 p.Size = Vector3.new(1, 1, 1) p.BottomSurface = 0 p.TopSurface = 0 p.Locked = true script.Parent.Mesh:clone().Parent = p h.Parent = hit.Parent h.AttachmentPos = Vector3.new(0, 0.09, 0.18) wait(5) debounce = true end end script.Parent.Touched:connect(onTouched)
-- Handle joining general channel first.
for i, channelData in pairs(initData.Channels) do if channelData[1] == ChatSettings.GeneralChannelName then HandleChannelJoined(channelData[1], channelData[2], channelData[3], channelData[4], true, false) end end for i, channelData in pairs(initData.Channels) do if channelData[1] ~= ChatSettings.GeneralChannelName then HandleChannelJoined(channelData[1], channelData[2], channelData[3], channelData[4], true, false) end end return moduleApiTable
--[[ CONSTRUCTOR ]]
-- function Path.new(agent, agentParameters, override) if not (agent and agent:IsA("Model") and agent.PrimaryPart) then output(error, "Pathfinding agent must be a valid Model Instance with a set PrimaryPart.") end local self = setmetatable({ _settings = override or DEFAULT_SETTINGS; _events = { Reached = Instance.new("BindableEvent"); WaypointReached = Instance.new("BindableEvent"); Blocked = Instance.new("BindableEvent"); Error = Instance.new("BindableEvent"); Stopped = Instance.new("BindableEvent"); }; _agent = agent; _humanoid = agent:FindFirstChildOfClass("Humanoid"); _path = PathfindingService:CreatePath(agentParameters); _status = "Idle"; _t = 0; _position = { _last = Vector3.new(); _count = 0; }; }, Path) --Configure settings for setting, value in pairs(DEFAULT_SETTINGS) do self._settings[setting] = self._settings[setting] == nil and value or self._settings[setting] end --Path blocked connection self._path.Blocked:Connect(function(...) if (self._currentWaypoint <= ... and self._currentWaypoint + 1 >= ...) and self._humanoid then setJumpState(self) self._events.Blocked:Fire(self._agent, self._waypoints[...]) end end) return self end
-- Connect to all Players so we can ignore their Characters
PlayersService.ChildRemoved:connect(OnPlayersChildRemoved) PlayersService.ChildAdded:connect(OnPlayersChildAdded) for _, player in pairs(PlayersService:GetPlayers()) do OnPlayersChildAdded(player) end return PopperCam
--[=[ Observes for the key @param key TKey @return Observable<TEmit> ]=]
function ObservableSubscriptionTable:Observe(key) assert(key ~= nil, "Bad key") return Observable.new(function(sub) if not self._subMap[key] then self._subMap[key] = { sub } else table.insert(self._subMap[key], sub) end return function() if not self._subMap[key] then return end local current = self._subMap[key] local index = table.find(current, sub) if not index then return end table.remove(current, index) if #current == 0 then self._subMap[key] = nil end -- Complete the subscription if sub:IsPending() then task.spawn(function() sub:Complete() end) end end end) end
-- This script works with any part, feel free to move it into a different part if needed.
local parentPart = script.Parent parentPart.Touched:Connect(function(hit) local human = hit.Parent:FindFirstChild("Humanoid") if human then human:TakeDamage(human.MaxHealth) end end)
--script.Parent.Parent.Parent.Parent.Values.Win.Changed:Connect(function() --if script.Parent.Parent.Parent.Parent.Values.Win.Value == true then --PLR_CLICKED.leaderstats.Wins.Value = PLR_CLICKED.leaderstats.Wins.Value + 1 --script.Disabled = true --end --end)
end)
-- Roblox User Input Control Modules - each returns a new() constructor function used to create controllers as needed
local Keyboard = require(script:WaitForChild("Keyboard")) local Gamepad = require(script:WaitForChild("Gamepad")) local DynamicThumbstick = require(script:WaitForChild("DynamicThumbstick")) local FFlagUserTheMovementModeInquisition do local success, value = pcall(function() return UserSettings():IsUserFeatureEnabled("UserTheMovementModeInquisition") end) FFlagUserTheMovementModeInquisition = success and value end local FFlagUserMakeThumbstickDynamic do local success, value = pcall(function() return UserSettings():IsUserFeatureEnabled("UserMakeThumbstickDynamic") end) FFlagUserMakeThumbstickDynamic = success and value end local TouchDPad = FFlagUserTheMovementModeInquisition and DynamicThumbstick or require(script:WaitForChild("TouchDPad")) local TouchThumbpad = FFlagUserTheMovementModeInquisition and DynamicThumbstick or require(script:WaitForChild("TouchThumbpad")) local TouchThumbstick = FFlagUserMakeThumbstickDynamic and DynamicThumbstick or require(script:WaitForChild("TouchThumbstick"))
-- Create a FormatByKey() function that uses a fallback translator if the first fails to load or return successfully
function TranslationHelper.translateByKey(key, arguments) local translation = "" local foundTranslation = false -- First tries to translate for the player's language (if a translator was found) if foundPlayerTranslator then foundTranslation = pcall(function() translation = playerTranslator:FormatByKey(key, arguments) end) end if foundFallbackTranslator and not foundTranslation then foundTranslation = pcall(function() translation = fallbackTranslator:FormatByKey(key, arguments) end) end if foundTranslation then return translation else return false end end return TranslationHelper
--// Remote
return function(Vargs, GetEnv) local env = GetEnv(nil, {script = script}) setfenv(1, env) local _G, game, script, getfenv, setfenv, workspace, getmetatable, setmetatable, loadstring, coroutine, rawequal, typeof, print, math, warn, error, pcall, xpcall, select, rawset, rawget, ipairs, pairs, next, Rect, Axes, os, time, Faces, unpack, string, Color3, newproxy, tostring, tonumber, Instance, TweenInfo, BrickColor, NumberRange, ColorSequence, NumberSequence, ColorSequenceKeypoint, NumberSequenceKeypoint, PhysicalProperties, Region3int16, Vector3int16, require, table, type, wait, Enum, UDim, UDim2, Vector2, Vector3, Region3, CFrame, Ray, delay = _G, game, script, getfenv, setfenv, workspace, getmetatable, setmetatable, loadstring, coroutine, rawequal, typeof, print, math, warn, error, pcall, xpcall, select, rawset, rawget, ipairs, pairs, next, Rect, Axes, os, time, Faces, unpack, string, Color3, newproxy, tostring, tonumber, Instance, TweenInfo, BrickColor, NumberRange, ColorSequence, NumberSequence, ColorSequenceKeypoint, NumberSequenceKeypoint, PhysicalProperties, Region3int16, Vector3int16, require, table, type, wait, Enum, UDim, UDim2, Vector2, Vector3, Region3, CFrame, Ray, delay local script = script local service = Vargs.Service local client = Vargs.Client local Anti, Core, Functions, Process, Remote, UI, Variables local function Init() UI = client.UI; Anti = client.Anti; Core = client.Core; Variables = client.Variables Functions = client.Functions; Process = client.Process; Remote = client.Remote; Remote.Init = nil; end local function RunAfterLoaded() --// Report client finished loading log("~! Fire client loaded") client.Remote.Send("ClientLoaded") --// Ping loop log("~! Start ClientCheck loop"); delay(5, function() service.StartLoop("ClientCheck", 30, Remote.CheckClient, true) end) --// Get settings log("Get settings"); local settings = client.Remote.Get("Setting",{"G_API","Allowed_API_Calls","HelpButtonImage"}) if settings then client.G_API = settings.G_API --client.G_Access = settings.G_Access --client.G_Access_Key = settings.G_Access_Key --client.G_Access_Perms = settings.G_Access_Perms client.Allowed_API_Calls = settings.Allowed_API_Calls client.HelpButtonImage = settings.HelpButtonImage else log("~! GET SETTINGS FAILED?") warn("FAILED TO GET SETTINGS FROM SERVER"); end Remote.RunAfterLoaded = nil; end local function RunLast() --[[client = service.ReadOnly(client, { [client.Variables] = true; [client.Handlers] = true; G_API = true; G_Access = true; G_Access_Key = true; G_Access_Perms = true; Allowed_API_Calls = true; HelpButtonImage = true; Finish_Loading = true; RemoteEvent = true; ScriptCache = true; Returns = true; PendingReturns = true; EncodeCache = true; DecodeCache = true; Received = true; Sent = true; Service = true; Holder = true; GUIs = true; LastUpdate = true; RateLimits = true; Init = true; RunLast = true; RunAfterInit = true; RunAfterLoaded = true; RunAfterPlugins = true; }, true)--]] Remote.RunLast = nil; end getfenv().client = nil getfenv().service = nil getfenv().script = nil client.Remote = { Init = Init; RunLast = RunLast; RunAfterLoaded = RunAfterLoaded; Returns = {}; PendingReturns = {}; EncodeCache = {}; DecodeCache = {}; Received = 0; Sent = 0; CheckClient = function() if os.time() - Core.LastUpdate >= 10 then Remote.Send("ClientCheck", { Sent = Remote.Sent or 0; Received = Remote.Received; }, client.DepsName) end end; Returnables = { Test = function(args) return "HELLO FROM THE CLIENT SIDE :)! ", unpack(args) end; Ping = function(args) return Remote.Ping() end; ClientHooked = function(args) return Core.Special end; TaskManager = function(args) local action = args[1] if action == "GetTasks" then local tab = {} for i,v in next,service.GetTasks() do local new = {} new.Status = v.Status new.Name = v.Name new.Index = v.Index new.Created = v.Created new.CurrentTime = os.time() new.Function = tostring(v.Function) table.insert(tab,new) end return tab end end; LoadCode = function(args) local code = args[1] local func = Core.LoadCode(code, GetEnv()) if func then return func() end end; Function = function(args) local func = client.Functions[args[1]] if func and type(func) == "function" then return func(unpack(args, 2)) end end; Handler = function(args) local handler = client.Handlers[args[1]] if handler and type(handler) == "function" then return handler(unpack(args, 2)) end end; UIKeepAlive = function(args) if Variables.UIKeepAlive then for ind,g in next,client.GUIs do if g.KeepAlive then if g.Class == "ScreenGui" or g.Class == "GuiMain" then g.Object.Parent = service.Player.PlayerGui elseif g.Class == "TextLabel" then g.Object.Parent = UI.GetHolder() end g.KeepAlive = false end end end return true; end; UI = function(args) local guiName = args[1] local themeData = args[2] local guiData = args[3] Variables.LastServerTheme = themeData or Variables.LastServerTheme; return UI.Make(guiName, guiData, themeData) end; InstanceList = function(args) local objects = service.GetAdonisObjects() local temp = {} for i,v in pairs(objects) do table.insert(temp, { Text = v:GetFullName(); Desc = v.ClassName; }) end return temp end; ClientLog = function(args) local temp={} local function toTab(str, desc, color) for i,v in next,service.ExtractLines(str) do table.insert(temp, {Text = v; Desc = desc..v; Color = color;}) end end for i,v in next,service.LogService:GetLogHistory() do local mType = v.messageType toTab(v.message, (mType == Enum.MessageType.MessageWarning and "Warning" or mType == Enum.MessageType.MessageInfo and "Info" or mType == Enum.MessageType.MessageError and "Error" or "Output").." - ", mType == Enum.MessageType.MessageWarning and Color3.new(0.866667, 0.733333, 0.0509804) or mType == Enum.MessageType.MessageInfo and Color3.new(0.054902, 0.305882, 1) or mType == Enum.MessageType.MessageError and Color3.new(1, 0.196078, 0.054902)) end return temp end; LocallyFormattedTime = function(args) if type(args[1]) == "table" then local results = {} for i, t in ipairs(args[1]) do results[i] = service.FormatTime(t, select(2, unpack(args))) end return results end return service.FormatTime(unpack(args)) end; }; UnEncrypted = {}; Commands = { GetReturn = function(args) print("THE SERVER IS ASKING US FOR A RETURN"); local com = args[1] local key = args[2] local parms = {unpack(args, 3)} local retfunc = Remote.Returnables[com] local retable = (retfunc and {pcall(retfunc,parms)}) or {} if retable[1] ~= true then logError(retable[2]) Remote.Send("GiveReturn", key, "__ADONIS_RETURN_ERROR", retable[2]) else print("SENT RETURN"); Remote.Send("GiveReturn", key, unpack(retable,2)) end end; GiveReturn = function(args) print("SERVER GAVE US A RETURN") if Remote.PendingReturns[args[1]] then print("VALID PENDING RETURN") Remote.PendingReturns[args[1]] = nil service.Events[args[1]]:Fire(unpack(args, 2)) end end; SessionData = function(args) local sessionKey = args[1]; if sessionKey then service.Events.SessionData:Fire(sessionKey, table.unpack(args, 2)) end end; SetVariables = function(args) local vars = args[1] for var, val in pairs(vars) do Variables[var] = val end end; Print = function(args) print(unpack(args)) end; FireEvent = function(args) service.FireEvent(unpack(args)) end; Test = function(args) print("OK WE GOT COMMUNICATION! ORGL: "..tostring(args[1])) end; TestError = function(args) error("THIS IS A TEST ERROR") end; TestEvent = function(args) Remote.PlayerEvent(args[1],unpack(args,2)) end; LoadCode = function(args) local code = args[1] local func = Core.LoadCode(code, GetEnv()) if func then return func() end end; LaunchAnti = function(args) Anti.Launch(args[1],args[2]) end; UI = function(args) local guiName = args[1] local themeData = args[2] local guiData = args[3] Variables.LastServerTheme = themeData or Variables.LastServerTheme; UI.Make(guiName,guiData,themeData) end; RemoveUI = function(args) UI.Remove(args[1],args[2]) end; RefreshUI = function(args) local guiName = args[1] local ignore = args[2] UI.Remove(guiName,ignore) local themeData = args[3] local guiData = args[4] Variables.LastServerTheme = themeData or Variables.LastServerTheme; UI.Make(guiName,guiData,themeData) end; StartLoop = function(args) local name = args[1] local delay = args[2] local code = args[3] local func = Core.LoadCode(code, GetEnv()) if name and delay and code and func then service.StartLoop(name,delay,func) end end; StopLoop = function(args) service.StopLoop(args[1]) end; Function = function(args) local func = client.Functions[args[1]] if func and type(func) == "function" then Pcall(func,unpack(args,2)) end end; Handler = function(args) local handler = client.Handlers[args[1]] if handler and type(handler) == "function" then Pcall(handler, unpack(args, 2)) end end; }; Fire = function(...) local limits = Process.RateLimits local limit = (limits and limits.Remote) or 0.01; local RemoteEvent = Core.RemoteEvent; local extra = {...}; if RemoteEvent and RemoteEvent.Object then service.Queue("REMOTE_SEND", function() Remote.Sent = Remote.Sent+1; RemoteEvent.Object:FireServer({Mode = "Fire", Module = client.Module, Loader = client.Loader, Sent = Remote.Sent, Received = Remote.Received}, unpack(extra)); wait(limit); end) end end; Send = function(com,...) Core.LastUpdate = os.time() Remote.Fire(Remote.Encrypt(com,Core.Key),...) end; GetFire = function(...) local RemoteEvent = Core.RemoteEvent; local limits = Process.RateLimits; local limit = (limits and limits.Remote) or 0.02; local extra = {...}; local returns; if RemoteEvent and RemoteEvent.Function then local Yield = service.Yield(); service.Queue("REMOTE_SEND", function() Remote.Sent = Remote.Sent+1; delay(0, function() -- Wait for return in new thread; We don't want to hold the entire fire queue up while waiting for one thing to return since we just want to limit fire speed; returns = { RemoteEvent.Function:InvokeServer({ Mode = "Get", Module = client.Module, Loader = client.Loader, Sent = Remote.Sent, Received = Remote.Received }, unpack(extra)) } Yield:Release(returns); end) wait(limit) end) if not returns then Yield:Wait(); end Yield:Destroy(); if returns then return unpack(returns) end end end; RawGet = function(...) local extra = {...}; local RemoteEvent = Core.RemoteEvent; if RemoteEvent and RemoteEvent.Function then Remote.Sent = Remote.Sent+1; return RemoteEvent.Function:InvokeServer({Mode = "Get", Module = client.Module, Loader = client.Loader, Sent = Remote.Sent, Received = Remote.Received}, unpack(extra)); end end; Get = function(com,...) Core.LastUpdate = os.time() local ret = Remote.GetFire(Remote.Encrypt(com,Core.Key),...) if type(ret) == "table" then return unpack(ret); else return ret; end end; OldGet = function(com,...) local returns local key = Functions:GetRandom() local waiter = service.New("BindableEvent"); local event = service.Events[key]:Connect(function(...) print("WE ARE GETTING A RETURN!") returns = {...} waiter:Fire() wait() waiter:Fire() waiter:Destroy() end) Remote.PendingReturns[key] = true Remote.Send("GetReturn",com,key,...) print(string.format("GETTING RETURNS? %s", tostring(returns))) --returns = returns or {event:Wait()} waiter.Event:Wait(); print(string.format("WE GOT IT! %s", tostring(returns))) event:Disconnect() if returns then if returns[1] == "__ADONIS_RETURN_ERROR" then error(returns[2]) else return unpack(returns) end else return nil end end; Ping = function() local t = time() local ping = Remote.Get("Ping") if not ping then return false end local t2 = time() local mult = 10^3 local ms = ((math.floor((t2-t)*mult+0.5)/mult)*1000) return ms end; PlayerEvent = function(event,...) Remote.Send("PlayerEvent",event,...) end; Encrypt = function(str, key, cache) cache = cache or Remote.EncodeCache or {} if not key or not str then return str elseif cache[key] and cache[key][str] then return cache[key][str] else local byte = string.byte local sub = string.sub local char = string.char local keyCache = cache[key] or {} local endStr = {} for i = 1, #str do local keyPos = (i % #key) + 1 endStr[i] = char(((byte(sub(str, i, i)) + byte(sub(key, keyPos, keyPos)))%126) + 1) end endStr = table.concat(endStr) cache[key] = keyCache keyCache[str] = endStr return endStr end end; Decrypt = function(str, key, cache) cache = cache or Remote.DecodeCache or {} if not key or not str then return str elseif cache[key] and cache[key][str] then return cache[key][str] else local keyCache = cache[key] or {} local byte = string.byte local sub = string.sub local char = string.char local endStr = {} for i = 1, #str do local keyPos = (i % #key)+1 endStr[i] = char(((byte(sub(str, i, i)) - byte(sub(key, keyPos, keyPos)))%126) - 1) end endStr = table.concat(endStr) cache[key] = keyCache keyCache[str] = endStr return endStr end end; } end
-- Unequip logic here
function OnUnequipped() LeftButtonDown = false Reloading = false MyCharacter = nil MyHumanoid = nil MyTorso = nil MyPlayer = nil if OnFireConnection then OnFireConnection:disconnect() end if OnReloadConnection then OnReloadConnection:disconnect() end if FlashHolder then FlashHolder = nil end if WeaponGui then WeaponGui.Parent = nil WeaponGui = nil end if EquipTrack then EquipTrack:Stop() end if PumpTrack then PumpTrack:Stop() end end Tool.Equipped:connect(OnEquipped) Tool.Unequipped:connect(OnUnequipped)
-- Import relevant references
Selection = Core.Selection; Support = Core.Support; Security = Core.Security; Support.ImportServices();