Загрузка данных


--[[
    MUFFIN'S FLY GUI V4
    + FLY
    + NOCLIP
    + MOBILE SUPPORT
    + SPEED 10-300
]]

local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")

local player = Players.LocalPlayer

local flying = false
local noclip = false
local speed = 50

local ROT_SPEED_FACTOR = 20

local attachment
local lv
local ao
local character
local humanoid
local root

local originalCollision = {}

-- =========================================================
-- CLEAN OLD GUI
-- =========================================================

local playerGui = player:WaitForChild("PlayerGui")

local existing = playerGui:FindFirstChild("MuffinAestheticFly")

if existing then
	existing:Destroy()
end

-- =========================================================
-- GUI
-- =========================================================

local ScreenGui = Instance.new("ScreenGui")

ScreenGui.Name = "MuffinAestheticFly"
ScreenGui.ResetOnSpawn = false
ScreenGui.IgnoreGuiInset = true
ScreenGui.Parent = playerGui

local MainFrame = Instance.new("Frame")

MainFrame.Size = UDim2.fromOffset(220, 185)

MainFrame.Position =
	UDim2.new(
		0.5,
		-110,
		0.2,
		0
	)

MainFrame.BackgroundColor3 =
	Color3.fromRGB(
		15,
		15,
		20
	)

MainFrame.BackgroundTransparency = 0.1
MainFrame.BorderSizePixel = 0
MainFrame.Active = true
MainFrame.Parent = ScreenGui

local Corner = Instance.new("UICorner")

Corner.CornerRadius =
	UDim.new(
		0,
		12
	)

Corner.Parent = MainFrame

local UIStroke = Instance.new("UIStroke")

UIStroke.Thickness = 2.5
UIStroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
UIStroke.Parent = MainFrame

local UIGradient = Instance.new("UIGradient")

UIGradient.Color =
	ColorSequence.new({

		ColorSequenceKeypoint.new(
			0,
			Color3.fromRGB(
				255,
				0,
				255
			)
		),

		ColorSequenceKeypoint.new(
			0.5,
			Color3.fromRGB(
				0,
				255,
				255
			)
		),

		ColorSequenceKeypoint.new(
			1,
			Color3.fromRGB(
				255,
				0,
				255
			)
		)
	})

UIGradient.Parent = UIStroke

-- =========================================================
-- TITLE
-- =========================================================

local Title = Instance.new("TextLabel")

Title.Size =
	UDim2.new(
		1,
		0,
		0,
		34
	)

Title.Position =
	UDim2.fromOffset(
		0,
		4
	)

Title.BackgroundTransparency = 1

Title.Text = "MUFFIN'S V4"
Title.Font = Enum.Font.FredokaOne
Title.TextSize = 22
Title.TextColor3 = Color3.new(1,1,1)

Title.Parent = MainFrame

local SubTitle = Instance.new("TextLabel")

SubTitle.Size =
	UDim2.new(
		1,
		0,
		0,
		15
	)

SubTitle.Position =
	UDim2.fromOffset(
		0,
		32
	)

SubTitle.BackgroundTransparency = 1

SubTitle.Text = "FLIGHT + NOCLIP"
SubTitle.Font = Enum.Font.GothamBold
SubTitle.TextSize = 8

SubTitle.TextColor3 =
	Color3.fromRGB(
		150,
		150,
		150
	)

SubTitle.Parent = MainFrame

-- =========================================================
-- SPEED
-- =========================================================

local SpeedFrame = Instance.new("Frame")

SpeedFrame.Size =
	UDim2.new(
		0.88,
		0,
		0,
		31
	)

SpeedFrame.Position =
	UDim2.new(
		0.06,
		0,
		0,
		51
	)

SpeedFrame.BackgroundTransparency = 1
SpeedFrame.Parent = MainFrame

local SpeedMinus = Instance.new("TextButton")

SpeedMinus.Size =
	UDim2.new(
		0.25,
		0,
		1,
		0
	)

SpeedMinus.BackgroundColor3 =
	Color3.fromRGB(
		30,
		30,
		40
	)

SpeedMinus.Text = "−"
SpeedMinus.TextColor3 = Color3.new(1,1,1)
SpeedMinus.TextSize = 20
SpeedMinus.Font = Enum.Font.GothamBold
SpeedMinus.Parent = SpeedFrame

Instance.new(
	"UICorner",
	SpeedMinus
).CornerRadius =
	UDim.new(
		0,
		6
	)

local SpeedLabel = Instance.new("TextLabel")

SpeedLabel.Size =
	UDim2.new(
		0.5,
		0,
		1,
		0
	)

SpeedLabel.Position =
	UDim2.new(
		0.25,
		0,
		0,
		0
	)

SpeedLabel.BackgroundTransparency = 1

SpeedLabel.Text =
	"SPEED: "
	..
	speed

SpeedLabel.TextColor3 =
	Color3.new(
		1,
		1,
		1
	)

SpeedLabel.TextSize = 11
SpeedLabel.Font = Enum.Font.GothamBold
SpeedLabel.Parent = SpeedFrame

local SpeedPlus = Instance.new("TextButton")

SpeedPlus.Size =
	UDim2.new(
		0.25,
		0,
		1,
		0
	)

SpeedPlus.Position =
	UDim2.new(
		0.75,
		0,
		0,
		0
	)

SpeedPlus.BackgroundColor3 =
	Color3.fromRGB(
		30,
		30,
		40
	)

SpeedPlus.Text = "+"
SpeedPlus.TextColor3 = Color3.new(1,1,1)
SpeedPlus.TextSize = 18
SpeedPlus.Font = Enum.Font.GothamBold
SpeedPlus.Parent = SpeedFrame

Instance.new(
	"UICorner",
	SpeedPlus
).CornerRadius =
	UDim.new(
		0,
		6
	)

-- =========================================================
-- BUTTON CREATOR
-- =========================================================

local function createToggle(text,y)

	local button =
		Instance.new("TextButton")

	button.Size =
		UDim2.new(
			0.88,
			0,
			0,
			38
		)

	button.Position =
		UDim2.new(
			0.06,
			0,
			0,
			y
		)

	button.BackgroundColor3 =
		Color3.fromRGB(
			30,
			30,
			40
		)

	button.Text = text

	button.TextColor3 =
		Color3.new(
			1,
			1,
			1
		)

	button.TextSize = 12
	button.Font = Enum.Font.GothamBold
	button.AutoButtonColor = false
	button.Parent = MainFrame

	Instance.new(
		"UICorner",
		button
	).CornerRadius =
		UDim.new(
			0,
			7
		)

	local stroke =
		Instance.new("UIStroke")

	stroke.Thickness = 1.5

	stroke.Color =
		Color3.fromRGB(
			60,
			60,
			70
		)

	stroke.Parent = button

	return button,stroke
end

local FlyToggle,FlyStroke =
	createToggle(
		"FLY: INACTIVE",
		89
	)

local NoclipToggle,NoclipStroke =
	createToggle(
		"NOCLIP: INACTIVE",
		133
	)

-- =========================================================
-- SPEED BUTTONS
-- =========================================================

local function updateSpeed()

	SpeedLabel.Text =
		"SPEED: "
		..
		tostring(speed)

end

SpeedMinus.MouseButton1Click:
Connect(function()

	if speed > 10 then

		speed -= 10
		updateSpeed()

	end
end)

SpeedPlus.MouseButton1Click:
Connect(function()

	if speed < 300 then

		speed += 10
		updateSpeed()

	end
end)

-- =========================================================
-- CHARACTER
-- =========================================================

local function getCharacter()

	character =
		player.Character
		or
		player.CharacterAdded:Wait()

	humanoid =
		character:
		WaitForChild(
			"Humanoid"
		)

	root =
		character:
		WaitForChild(
			"HumanoidRootPart"
		)

end

getCharacter()

-- =========================================================
-- FLY
-- =========================================================

local function cleanupFly()

	if humanoid then

		humanoid.PlatformStand =
			false

	end

	if attachment then

		attachment:
			Destroy()

	end

	attachment = nil
	lv = nil
	ao = nil
end

local function setupPhysics()

	task.defer(function()

		getCharacter()

		cleanupFly()

		if not flying then
			return
		end

		humanoid.PlatformStand =
			true

		attachment =
			Instance.new(
				"Attachment"
			)

		attachment.Name =
			"MuffinFlyAttachment"

		attachment.Parent =
			root

		lv =
			Instance.new(
				"LinearVelocity"
			)

		lv.Name =
			"MuffinVelocity"

		lv.MaxForce =
			9e9

		lv.VectorVelocity =
			Vector3.zero

		lv.Attachment0 =
			attachment

		lv.Parent =
			attachment

		ao =
			Instance.new(
				"AlignOrientation"
			)

		ao.Name =
			"MuffinOrientation"

		ao.MaxTorque =
			9e9

		ao.Responsiveness =
			200

		ao.RigidityEnabled =
			false

		ao.Mode =
			Enum.OrientationAlignmentMode.OneAttachment

		ao.Attachment0 =
			attachment

		ao.Parent =
			attachment
	end)
end

-- =========================================================
-- NOCLIP
-- =========================================================

local function saveCollisionState()

	if not character then
		return
	end

	for _,part in ipairs(
		character:GetDescendants()
	) do

		if part:IsA("BasePart") then

			if originalCollision[part] == nil then

				originalCollision[part] =
					part.CanCollide

			end
		end
	end
end

local function applyNoclip()

	if not noclip
		or not character
	then
		return
	end

	for _,part in ipairs(
		character:GetDescendants()
	) do

		if part:IsA("BasePart") then

			part.CanCollide =
				false

		end
	end
end

local function restoreCollision()

	for part,state in pairs(
		originalCollision
	) do

		if part
			and part.Parent
		then

			part.CanCollide =
				state

		end
	end

	originalCollision = {}
end

-- =========================================================
-- CONTROLS
-- =========================================================

local PlayerModule =
	require(
		player.PlayerScripts:
		WaitForChild(
			"PlayerModule"
		)
	)

local Controls =
	PlayerModule:GetControls()

-- =========================================================
-- FLY TOGGLE
-- =========================================================

FlyToggle.MouseButton1Click:
Connect(function()

	flying =
		not flying

	if flying then

		FlyToggle.Text =
			"FLY: ACTIVE"

		TweenService:Create(
			FlyStroke,

			TweenInfo.new(
				0.25
			),

			{
				Color =
					Color3.fromRGB(
						0,
						255,
						150
					)
			}
		):Play()

		setupPhysics()

	else

		FlyToggle.Text =
			"FLY: INACTIVE"

		TweenService:Create(
			FlyStroke,

			TweenInfo.new(
				0.25
			),

			{
				Color =
					Color3.fromRGB(
						255,
						60,
						70
					)
			}
		):Play()

		cleanupFly()

	end
end)

-- =========================================================
-- NOCLIP TOGGLE
-- =========================================================

NoclipToggle.MouseButton1Click:
Connect(function()

	noclip =
		not noclip

	if noclip then

		getCharacter()

		saveCollisionState()

		NoclipToggle.Text =
			"NOCLIP: ACTIVE"

		TweenService:Create(
			NoclipStroke,

			TweenInfo.new(
				0.25
			),

			{
				Color =
					Color3.fromRGB(
						0,
						255,
						150
					)
			}
		):Play()

	else

		NoclipToggle.Text =
			"NOCLIP: INACTIVE"

		TweenService:Create(
			NoclipStroke,

			TweenInfo.new(
				0.25
			),

			{
				Color =
					Color3.fromRGB(
						255,
						60,
						70
					)
			}
		):Play()

		restoreCollision()

	end
end)

-- =========================================================
-- MAIN LOOP
-- =========================================================

RunService.RenderStepped:
Connect(function(deltaTime)

	UIGradient.Rotation =
		(tick()*120)
		%
		360

	Title.TextColor3 =
		Color3.fromHSV(
			tick()%5/5,
			0.4,
			1
		)

	if noclip then

		applyNoclip()

	end

	if flying
		and root
		and workspace.CurrentCamera
		and lv
		and ao
	then

		local camera =
			workspace.CurrentCamera

		local moveVector =
			Controls:
			GetMoveVector()

		local targetDirection =
			Vector3.zero

		if moveVector.Magnitude > 0 then

			targetDirection =
				(
					camera.CFrame.LookVector
					*
					-moveVector.Z
				)
				+
				(
					camera.CFrame.RightVector
					*
					moveVector.X
				)

		end

		if UserInputService:
			IsKeyDown(
				Enum.KeyCode.Space
			)
		then

			targetDirection +=
				Vector3.new(
					0,
					1,
					0
				)

		elseif UserInputService:
			IsKeyDown(
				Enum.KeyCode.LeftShift
			)
		then

			targetDirection +=
				Vector3.new(
					0,
					-1,
					0
				)

		end

		if targetDirection.Magnitude > 0 then

			lv.VectorVelocity =
				targetDirection.Unit
				*
				speed

		else

			lv.VectorVelocity =
				Vector3.zero

		end

		local alpha =
			1
			-
			math.exp(
				-ROT_SPEED_FACTOR
				*
				deltaTime
			)

		ao.CFrame =
			ao.CFrame:
			Lerp(
				camera.CFrame,
				alpha
			)

	end
end)

-- =========================================================
-- RESPAWN
-- =========================================================

player.CharacterAdded:
Connect(function(newCharacter)

	restoreCollision()

	character =
		newCharacter

	humanoid =
		character:
		WaitForChild(
			"Humanoid"
		)

	root =
		character:
		WaitForChild(
			"HumanoidRootPart"
		)

	if noclip then

		task.wait(.2)

		saveCollisionState()

	end

	if flying then

		task.wait(.5)

		setupPhysics()

	end
end)

-- =========================================================
-- DRAG
-- =========================================================

local dragging
local dragStart
local startPos

MainFrame.InputBegan:
Connect(function(input)

	if
		input.UserInputType
			==
			Enum.UserInputType.MouseButton1

		or

		input.UserInputType
			==
			Enum.UserInputType.Touch
	then

		dragging =
			true

		dragStart =
			input.Position

		startPos =
			MainFrame.Position

	end
end)

UserInputService.InputChanged:
Connect(function(input)

	if dragging
		and
		(
			input.UserInputType
			==
			Enum.UserInputType.MouseMovement

			or

			input.UserInputType
			==
			Enum.UserInputType.Touch
		)
	then

		local delta =
			input.Position
			-
			dragStart

		MainFrame.Position =
			UDim2.new(

				startPos.X.Scale,

				startPos.X.Offset
				+
				delta.X,

				startPos.Y.Scale,

				startPos.Y.Offset
				+
				delta.Y
			)

	end
end)

UserInputService.InputEnded:
Connect(function(input)

	if
		input.UserInputType
			==
			Enum.UserInputType.MouseButton1

		or

		input.UserInputType
			==
			Enum.UserInputType.Touch
	then

		dragging =
			false

	end
end)

print("MUFFIN V4 FLY + NOCLIP LOADED")