Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local UserInputService = game:GetService("UserInputService")
- local TweenService = game:GetService("TweenService")
- local RunService = game:GetService("RunService")
- local StarterGui = game:GetService("StarterGui")
- local SoundService = game:GetService("SoundService")
- local localPlayer = Players.LocalPlayer
- local character = localPlayer.Character
- local mouse = localPlayer:GetMouse()
- local camera = workspace.CurrentCamera
- local camtype = camera.CameraType
- local connections = {}
- lib = {}
- lib.wrap = function(f)
- return coroutine.wrap(f)()
- end
- wrap = lib.wrap
- lib.messageOut = function(title, msg)
- StarterGui:SetCore("SendNotification",
- {
- Title = title,
- Text = msg
- }
- )
- end
- local wait = function(int)
- if not int then int = 0 end
- local t = tick()
- repeat
- RunService.Heartbeat:Wait(0)
- until (tick() - t) >= int
- return (tick() - t), t
- end
- spawn(function()
- lib.messageOut("Admin successfully loaded", "Have fun!")
- end)
- lib.lock = function(instance, par)
- locks[instance] = true
- instance.Parent = par or instance.Parent
- instance.Name = "RightGrip"
- end
- lock = lib.lock
- locks = {}
- lib.connect = function(name, connection) -- no :(
- connections[name .. tostring(math.random(1000000, 9999999))] = connection
- return connection
- end
- lib.disconnect = function(name)
- for title, connection in pairs(connections) do
- if title:find(name) == 1 then
- connection:Disconnect()
- end
- end
- end
- if not speed then speed = 5 end
- if connections["fly"] then lib.disconnect("fly") character:FindFirstChildWhichIsA("Humanoid").PlatformStand = false end
- local dir = {w = false, a = false, s = false, d = false}
- local cf = Instance.new("CFrameValue")
- flyPart = flyPart or Instance.new("Part")
- flyPart.Anchored = true
- pcall(function()
- flyPart.CFrame = character.HumanoidRootPart.CFrame
- end)
- lib.connect("fly", RunService.RenderStepped:Connect(function()
- if not character:FindFirstChild("HumanoidRootPart") then return end
- local primaryPart = character.HumanoidRootPart
- local humanoid = character:FindFirstChildWhichIsA("Humanoid")
- local x, y, z = 0, 0, 0
- if dir.w then z = -1 * speed end
- if dir.a then x = -1 * speed end
- if dir.s then z = 1 * speed end
- if dir.d then x = 1 * speed end
- if dir.q then y = 1 * speed end
- if dir.e then y = -1 * speed end
- for i, v in pairs(character:GetDescendants()) do
- if v:IsA("BasePart") then
- v.Velocity = Vector3.new(0, 0, 0)
- v.RotVelocity = Vector3.new(0, 0, 0)
- end
- end
- flyPart.CFrame = CFrame.new(
- flyPart.CFrame.p,
- (camera.CFrame * CFrame.new(0, 0, -100)).p
- )
- local moveDir = CFrame.new(x,y,z)
- cf.Value = cf.Value:lerp(moveDir, 0.2)
- flyPart.CFrame = flyPart.CFrame:lerp(flyPart.CFrame * cf.Value, 0.2)
- primaryPart.CFrame = flyPart.CFrame
- humanoid.PlatformStand = true
- end))
- lib.connect("fly", UserInputService.InputBegan:Connect(function(input, event)
- if event then return end
- local code, codes = input.KeyCode, Enum.KeyCode
- if code == codes.W then
- dir.w = true
- elseif code == codes.A then
- dir.a = true
- elseif code == codes.S then
- dir.s = true
- elseif code == codes.D then
- dir.d = true
- elseif code == codes.Q then
- dir.q = true
- elseif code == codes.E then
- dir.e = true
- elseif code == codes.Space then
- dir.q = true
- end
- end))
- lib.connect("fly", UserInputService.InputEnded:Connect(function(input, event)
- if event then return end
- local code, codes = input.KeyCode, Enum.KeyCode
- if code == codes.W then
- dir.w = false
- elseif code == codes.A then
- dir.a = false
- elseif code == codes.S then
- dir.s = false
- elseif code == codes.D then
- dir.d = false
- elseif code == codes.Q then
- dir.q = false
- elseif code == codes.E then
- dir.e = false
- elseif code == codes.Space then
- dir.q = false
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement