Jetpack

Run Settings
LanguageLua
Language Version
Run Command
if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end local Player,game,owner = owner,game local RealPlayer = Player do local rp = RealPlayer script.Parent = rp.Character --RemoteEvent for communicating local Event = Instance.new("RemoteEvent") Event.Name = "UserInput_Event" --Fake event to make stuff like Mouse.KeyDown work local function fakeEvent() local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end} t.connect = t.Connect return t end --Creating fake input objects with fake variables local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()} local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()} local CAS = {Actions={},BindAction=function(self,name,fun,touch,...) CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil end} --Merged 2 functions into one by checking amount of arguments CAS.UnbindAction = CAS.BindAction --This function will trigger the events that have been :Connect()'ed local function te(self,ev,...) local t = m[ev] if t and t._fakeEvent then for _,f in pairs(t.Functions) do f(...) end end end m.TrigEvent = te UIS.TrigEvent = te Event.OnServerEvent:Connect(function(plr,io) if plr~=rp then return end m.Target = io.Target m.Hit = io.Hit if not io.isMouse then local b = io.UserInputState == Enum.UserInputState.Begin if io.UserInputType == Enum.UserInputType.MouseButton1 then return m:TrigEvent(b and "Button1Down" or "Button1Up") end for _,t in pairs(CAS.Actions) do for _,k in pairs(t.Keys) do if k==io.KeyCode then t.Function(t.Name,io.UserInputState,io) end end end m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower()) UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false) end end) Event.Parent = NLS([==[ local Player = game:GetService("Players").LocalPlayer local Event = script:WaitForChild("UserInput_Event") local Mouse = Player:GetMouse() local UIS = game:GetService("UserInputService") local input = function(io,a) if a then return end --Since InputObject is a client-side instance, we create and pass table instead Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target}) end UIS.InputBegan:Connect(input) UIS.InputEnded:Connect(input) local h,t --Give the server mouse data 30 times every second, but only if the values changed --If player is not moving their mouse, client won't fire events while wait(1/30) do if h~=Mouse.Hit or t~=Mouse.Target then h,t=Mouse.Hit,Mouse.Target Event:FireServer({isMouse=true,Target=t,Hit=h}) end end]==],Player.Character) ----Sandboxed game object that allows the usage of client-side methods and services --Real game object local _rg = game --Metatable for fake service local fsmt = { __index = function(self,k) local s = rawget(self,"_RealService") if s then return s[k] end end, __newindex = function(self,k,v) local s = rawget(self,"_RealService") if s then s[k]=v end end, __call = function(self,...) local s = rawget(self,"_RealService") if s then return s(...) end end } local function FakeService(t,RealService) t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService return setmetatable(t,fsmt) end --Fake game object local g = { GetService = function(self,s) return self[s] end, Players = FakeService({ LocalPlayer = FakeService({GetMouse=function(self)return m end},Player) },"Players"), UserInputService = FakeService(UIS,"UserInputService"), ContextActionService = FakeService(CAS,"ContextActionService"), } rawset(g.Players,"localPlayer",g.Players.LocalPlayer) g.service = g.GetService g.RunService = FakeService({ RenderStepped = _rg:GetService("RunService").Heartbeat, BindToRenderStep = function(self,name,_,fun) self._btrs[name] = self.Heartbeat:Connect(fun) end, UnbindFromRenderStep = function(self,name) self._btrs[name]:Disconnect() end, },"RunService") setmetatable(g,{ __index=function(self,s) return _rg:GetService(s) or typeof(_rg[s])=="function" and function(_,...)return _rg[s](_rg,...)end or _rg[s] end, __newindex = fsmt.__newindex, __call = fsmt.__call }) --Changing owner to fake player object to support owner:GetMouse() game,owner = g,g.Players.LocalPlayer end script.Parent = ___JetPack___ local plr = owner local char = plr.Character local uis = game:service("UserInputService") local mod,mp,cp,cp2,pp,pp2,pe,pe2,pe3,pe4,pe5,pe6,sEnable,colNum,colList,sfg,frm,frm2,frm3,hum,bodyVel,bodyGyro,fsound,tr,att0,att1 --Scope evasion. function generateModel() char = plr.Character mod = Instance.new("Model",char) mod.Name = "Pack" mp = Instance.new("Part",mod) mp.TopSurface = "Smooth" mp.BottomSurface = "Smooth" mp.Material = "Glass" mp:BreakJoints() mp.Size = Vector3.new(1,2,0.5) mp.CanCollide = false mp.CFrame = CFrame.new(0,0,0) cp = Instance.new("Part",mod) cp.TopSurface = "Smooth" cp.BottomSurface = "Smooth" cp:BreakJoints() cp.Material = "Glass" cp.Size = Vector3.new(2,0.5,0.5) cp.CanCollide = false cp.Shape = "Cylinder" cp.CFrame = CFrame.new(0,0.5,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(90)) cp2 = Instance.new("Part",mod) cp2.TopSurface = "Smooth" cp2.BottomSurface = "Smooth" cp2.Material = "Glass" cp2:BreakJoints() cp2.Size = Vector3.new(2,0.5,0.5) cp2.CanCollide = false cp2.Shape = "Cylinder" cp2.CFrame = CFrame.new(0,-0.5,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(90)) sequence = { ColorSequenceKeypoint.new(0,Color3.new(1,0,0)), ColorSequenceKeypoint.new(0.2,Color3.new(1,1,0)), ColorSequenceKeypoint.new(0.4,Color3.new(0,1,0)), ColorSequenceKeypoint.new(0.6,Color3.new(0,1,1)), ColorSequenceKeypoint.new(0.8,Color3.new(0,0,1)), ColorSequenceKeypoint.new(1,Color3.new(1,0,1)) } pp = Instance.new("Part",mod) pp.TopSurface = "Smooth" pp.BottomSurface = "Smooth" pp:BreakJoints() pp.Size = Vector3.new(0.5,0.2,0.5) pp.CanCollide = false pp.Transparency = 1 pp.CFrame = CFrame.new(-0.5,1,0) pp2 = Instance.new("Part",mod) pp2.TopSurface = "Smooth" pp2.BottomSurface = "Smooth" pp2:BreakJoints() pp2.Size = Vector3.new(0.5,0.2,0.5) pp2.CanCollide = false pp2.Transparency = 1 pp2.CFrame = CFrame.new(0.5,1,0) pe = Instance.new("ParticleEmitter",pp) pe.Texture = "rbxassetid://288978836" pe.EmissionDirection = Enum.NormalId.Bottom pe.Lifetime = NumberRange.new(0.1,0.3) pe.Size = NumberSequence.new(0.5,0) pe.Rate = 200 pe.Speed = NumberRange.new(10,10) pe.LightEmission = 1 pe.Rotation = NumberRange.new(0,359) pe2 = Instance.new("ParticleEmitter",pp2) pe2.Texture = "rbxassetid://288978836" pe2.EmissionDirection = Enum.NormalId.Bottom pe2.Lifetime = NumberRange.new(0.1,0.3) pe2.Size = NumberSequence.new(0.5,0) pe2.LightEmission = 1 pe2.Rate = 200 pe2.Speed = NumberRange.new(10,10) pe2.Rotation = NumberRange.new(0,359) pe3 = Instance.new("ParticleEmitter",pp) pe3.Texture = "rbxassetid://241922778" pe3.EmissionDirection = Enum.NormalId.Bottom pe3.Lifetime = NumberRange.new(0.7,0.9) pe3.Size = NumberSequence.new({NumberSequenceKeypoint.new(0,0),NumberSequenceKeypoint.new(0.3,0),NumberSequenceKeypoint.new(1,2)}) pe3.Transparency = NumberSequence.new({NumberSequenceKeypoint.new(0,0.2),NumberSequenceKeypoint.new(0.25,0.2),NumberSequenceKeypoint.new(1,1)}) pe3.Rate = 200 pe3.Speed = NumberRange.new(10,10) pe3.Rotation = NumberRange.new(0,359) pe4 = Instance.new("ParticleEmitter",pp2) pe4.Texture = "rbxassetid://241922778" pe4.EmissionDirection = Enum.NormalId.Bottom pe4.Lifetime = NumberRange.new(0.7,0.9) pe4.Size = NumberSequence.new({NumberSequenceKeypoint.new(0,0),NumberSequenceKeypoint.new(0.3,0),NumberSequenceKeypoint.new(1,2)}) pe4.Transparency = NumberSequence.new({NumberSequenceKeypoint.new(0,0.2),NumberSequenceKeypoint.new(0.25,0.2),NumberSequenceKeypoint.new(1,1)}) pe4.Rate = 200 pe4.Speed = NumberRange.new(10,10) pe4.Rotation = NumberRange.new(0,359) pe5 = Instance.new("ParticleEmitter",pp) pe5.Texture = "rbxassetid://241922778" pe5.EmissionDirection = Enum.NormalId.Bottom pe5.Lifetime = NumberRange.new(100,100) pe5.Size = NumberSequence.new({NumberSequenceKeypoint.new(0,0.1),NumberSequenceKeypoint.new(0.1,4),NumberSequenceKeypoint.new(1,5)}) pe5.Transparency = NumberSequence.new({NumberSequenceKeypoint.new(0,0.2),NumberSequenceKeypoint.new(0.25,0.2),NumberSequenceKeypoint.new(1,1)}) pe5.Rate = 50 pe5.Speed = NumberRange.new(0,0) pe5.Rotation = NumberRange.new(0,359) pe6 = Instance.new("ParticleEmitter",pp2) pe6.Texture = "rbxassetid://241922778" pe6.EmissionDirection = Enum.NormalId.Bottom pe6.Lifetime = NumberRange.new(100,100) pe6.Size = NumberSequence.new({NumberSequenceKeypoint.new(0,0.1),NumberSequenceKeypoint.new(0.1,4),NumberSequenceKeypoint.new(1,5)}) pe6.Transparency = NumberSequence.new({NumberSequenceKeypoint.new(0,0.2),NumberSequenceKeypoint.new(0.25,0.2),NumberSequenceKeypoint.new(1,1)}) pe6.Rate = 50 pe6.Speed = NumberRange.new(0,0) pe6.Rotation = NumberRange.new(0,359) tr = Instance.new("Trail") tr.Lifetime = 10 tr.LightEmission = 0 local transparency = 0 tr.Transparency = NumberSequence.new(0,0.5) tr.Color = ColorSequence.new(sequence) tr.Parent = game.Players.LocalPlayer.Character.Head att0 = Instance.new("Attachment",Humanoid) att0.CFrame = CFrame.new(0.6,-1,0.7) att0.Name = "TrailAttachment0" local att1 = Instance.new("Attachment",Game.Players.LocalPlayer.Character.HumanoidRootPart) att1.CFrame = CFrame.new(-0.6,-1,0.7) att1.Name = "TrailAttachment1" tr.Attachment0 = att0 tr.Attachment1 = att1 tr.Enabled = false pe5.Enabled = false pe6.Enabled = false sEnable = false colNum = 1 colList = {Color3.new(1,0,0),Color3.new(1,1,0),Color3.new(0,1,0),Color3.new(0,1,1),Color3.new(0,0,1),Color3.new(0,0,0),Color3.new(1,1,1),Color3.new(1,0,1)} sfg = Instance.new("SurfaceGui",mp) sfg.Face = Enum.NormalId.Back frm = Instance.new("Frame",sfg) frm.Size = UDim2.new(0.1,0,1,0) frm.BorderSizePixel = 0 frm2 = Instance.new("Frame",sfg) frm2.Size = UDim2.new(0.1,0,1,0) frm2.Position = UDim2.new(0.1,0,0,0) frm2.BorderSizePixel = 0 frm2.BackgroundColor3 = Color3.new(0,0,0) frm3 = Instance.new("Frame",frm2) frm3.Size = UDim2.new(1,0,-1,0) frm3.Position = UDim2.new(0,0,1,0) frm3.BorderSizePixel = 0 frm3.BackgroundColor3 = Color3.new(1,1,1) for i,v in pairs(mod:GetChildren()) do if v:IsA("BasePart") then v.TopSurface = "SmoothNoOutlines" v.BottomSurface = "SmoothNoOutlines" v.FrontSurface = "SmoothNoOutlines" v.RightSurface = "SmoothNoOutlines" v.BackSurface = "SmoothNoOutlines" v.LeftSurface = "SmoothNoOutlines" if v ~= mp then local w = Instance.new("Weld") w.Part0 = mp w.Part1 = v w.C0 = v.CFrame:inverse() * mp.CFrame w.Parent = mp end end end hum = char:FindFirstChildOfClass("Humanoid") local w = Instance.new("Weld") w.Part0 = mp w.Part1 = char:FindFirstChild("Torso") or char:FindFirstChild("UpperTorso") w.C0 = CFrame.new(0,0,-0.75) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)) w.Parent = mp bodyVel = Instance.new("BodyVelocity",char:FindFirstChild("Torso") or char:FindFirstChild("UpperTorso")) bodyVel.MaxForce = Vector3.new(0,0,0) bodyVel.Velocity = mp.CFrame.upVector * 10 bodyGyro = Instance.new("BodyGyro",char:FindFirstChild("Torso") or char:FindFirstChild("UpperTorso")) bodyGyro.MaxTorque = Vector3.new(0,0,0) bodyGyro.CFrame = workspace.CurrentCamera.CFrame * CFrame.Angles(math.rad(0),math.rad(0),math.rad(90)) msc = Instance.new("Sound",mp) msc.Volume = 10 msc.PlaybackSpeed = 1 msc.Pitch = 1 msc.SoundId = "rbxassetid://251976457" --133843808 msc.Name = "nib" msc.Looped = true fsound = Instance.new("Sound",mp) fsound.SoundId = "rbxassetid://183339994" fsound.Pitch = 1.5 fsound.Looped = true fsound.Volume = 1 end generateModel() plr.CharacterAdded:connect(function() wait() generateModel() end) local isJump = false local isSpace = false local speed = 30 local maxspeed = 60 local minspeed = 20 local rd = false local fd = false local gd = false uis.InputBegan:connect(function(key,processed) if not processed then if key.KeyCode == Enum.KeyCode.Space then if isJump == true then isSpace = true end end if key.KeyCode == Enum.KeyCode.Q then if sEnable == true then sEnable = false else sEnable = true end end if key.KeyCode == Enum.KeyCode.E then colNum = colNum + 1 if colNum > #colList + 1 then colNum = 1 end end if key.KeyCode == Enum.KeyCode.R then rd = true end if key.KeyCode == Enum.KeyCode.F then fd = true end if key.KeyCode == Enum.KeyCode.T and isSpace == true then msc:Play() fsound.Volume = 5 tr.Enabled = true gd = true end end end) uis.InputEnded:connect(function(key,processed) if not processed then if key.KeyCode == Enum.KeyCode.Space then isSpace = false end if key.KeyCode == Enum.KeyCode.R then rd = false end if key.KeyCode == Enum.KeyCode.F then fd = false end if key.KeyCode == Enum.KeyCode.T then msc:Stop() fsound.Volume = 1 tr.Enabled = false gd = false end end end) local r,g,b = 255,0,0 coroutine.resume(coroutine.create(function() while wait() do for i=0,255,10 do wait() g = i end for i=255,0,-10 do wait() r = i end for i=0,255,10 do wait() b = i end for i=255,0,-10 do wait() g = i end for i=0,255,10 do wait() r = i end for i=255,0,-10 do wait() b = i end end end)) game:service("RunService").RenderStepped:connect(function() if rd == true and fd == false then speed = speed + 0.2 end if rd == false and fd == true then speed = speed - 0.2 end if speed < minspeed then speed = minspeed end if speed > maxspeed then speed = maxspeed end local tspeed = speed frm3.BackgroundColor3 = Color3.new(1,1,1) if gd == true then tspeed = 240 frm3.BackgroundColor3 = Color3.new(1,1,0) end frm3.Size = UDim2.new(1,0,-((speed-minspeed)/(maxspeed-minspeed)),0) if colNum <= #colList then frm.BackgroundColor3 = colList[colNum] pe5.Color = ColorSequence.new(colList[colNum]) pe6.Color = ColorSequence.new(colList[colNum]) else frm.BackgroundColor3 = Color3.fromRGB(r,g,b) pe5.Color = ColorSequence.new(Color3.fromRGB(r,g,b)) pe6.Color = ColorSequence.new(Color3.fromRGB(r,g,b)) end fsound.Pitch = 1 + speed/50 local ray = Ray.new(char:FindFirstChild("HumanoidRootPart").CFrame.p,Vector3.new(0,-4,0)) local par,pos,norm = workspace:FindPartOnRayWithIgnoreList(ray,char:GetChildren(),false,true) if not par then isJump = true else isJump = false end if isSpace == true then if isJump == true then if fsound.IsPlaying == false then fsound:Play() end bodyVel.MaxForce = Vector3.new(10000,10000,10000) bodyVel.Velocity = mp.CFrame.upVector * tspeed bodyGyro.MaxTorque = Vector3.new(3000,3000,3000) bodyGyro.CFrame = workspace.CurrentCamera.CFrame * CFrame.Angles(math.rad(-90),math.rad(0),math.rad(0)) hum.PlatformStand = true pe.Enabled = true pe2.Enabled = true pe3.Enabled = true pe4.Enabled = true if sEnable == true then pe5.Enabled = true pe6.Enabled = true else pe5.Enabled = false pe6.Enabled = false end else bodyVel.MaxForce = Vector3.new(0,0,0) bodyVel.Velocity = mp.CFrame.upVector * tspeed bodyGyro.MaxTorque = Vector3.new(0,0,0) bodyGyro.CFrame = workspace.CurrentCamera.CFrame * CFrame.Angles(math.rad(-90),math.rad(0),math.rad(0)) hum.PlatformStand = true if hum:GetState() == Enum.HumanoidStateType.FallingDown then hum:ChangeState(Enum.HumanoidStateType.GettingUp) end pe.Enabled = false pe2.Enabled = false pe3.Enabled = false pe4.Enabled = false pe5.Enabled = false pe6.Enabled = false sEnable = false fsound:Stop() end else bodyVel.MaxForce = Vector3.new(0,0,0) bodyVel.Velocity = mp.CFrame.upVector * tspeed bodyGyro.MaxTorque = Vector3.new(0,0,0) bodyGyro.CFrame = workspace.CurrentCamera.CFrame * CFrame.Angles(math.rad(-90),math.rad(0),math.rad(0)) hum.PlatformStand = false if hum:GetState() == Enum.HumanoidStateType.FallingDown then hum:ChangeState(Enum.HumanoidStateType.GettingUp) end pe.Enabled = false pe2.Enabled = false pe3.Enabled = false pe4.Enabled = false pe5.Enabled = false pe6.Enabled = false sEnable = false fsound:Stop() end end)
Editor Settings
Theme
Key bindings
Full width
Lines