fly gui animation
Key RequiredUniversal

fly gui animation

Universal ScriptSodaAlexanderSodaAlexander 7K views 13.7K executesUpdated Jan 20, 2026
5.0/ 5(1 votes)
10100% Positive
Lua Script•381 lines (11053 chars)
local main = Instance.new("ScreenGui")
local Frame = Instance.new("Frame")
local up = Instance.new("TextButton")
local down = Instance.new("TextButton")
local onof = Instance.new("TextButton")
local TextLabel = Instance.new("TextLabel")
local plus = Instance.new("TextButton")
local speed = Instance.new("TextLabel")
local mine = Instance.new("TextButton")
local closebutton = Instance.new("TextButton")
local mini = Instance.new("TextButton")
local mini2 = Instance.new("TextButton")

main.Name = "main"
main.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
main.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
main.ResetOnSpawn = false

Frame.Parent = main
Frame.BackgroundColor3 = Color3.fromRGB(163, 255, 137)
Frame.BorderColor3 = Color3.fromRGB(103, 221, 213)
Frame.Position = UDim2.new(0.100320168, 0, 0.379746825, 0)
Frame.Size = UDim2.new(0, 190, 0, 57)

up.Name = "up"
up.Parent = Frame
up.BackgroundColor3 = Color3.fromRGB(79, 255, 152)
up.Size = UDim2.new(0, 44, 0, 28)
up.Font = Enum.Font.SourceSans
up.Text = "UP"
up.TextColor3 = Color3.fromRGB(0, 0, 0)
up.TextSize = 14.000

down.Name = "down"
down.Parent = Frame
down.BackgroundColor3 = Color3.fromRGB(215, 255, 121)
down.Position = UDim2.new(0, 0, 0.491228074, 0)
down.Size = UDim2.new(0, 44, 0, 28)
down.Font = Enum.Font.SourceSans
down.Text = "DOWN"
down.TextColor3 = Color3.fromRGB(0, 0, 0)
down.TextSize = 14.000

onof.Name = "onof"
onof.Parent = Frame
onof.BackgroundColor3 = Color3.fromRGB(255, 249, 74)
onof.Position = UDim2.new(0.702823281, 0, 0.491228074, 0)
onof.Size = UDim2.new(0, 56, 0, 28)
onof.Font = Enum.Font.SourceSans
onof.Text = "fly"
onof.TextColor3 = Color3.fromRGB(0, 0, 0)
onof.TextSize = 14.000

TextLabel.Parent = Frame
TextLabel.BackgroundColor3 = Color3.fromRGB(242, 60, 255)
TextLabel.Position = UDim2.new(0.469327301, 0, 0, 0)
TextLabel.Size = UDim2.new(0, 100, 0, 28)
TextLabel.Font = Enum.Font.SourceSans
TextLabel.Text = "FLY GUI V3"
TextLabel.TextColor3 = Color3.fromRGB(0, 0, 0)
TextLabel.TextScaled = true
TextLabel.TextWrapped = true

plus.Name = "plus"
plus.Parent = Frame
plus.BackgroundColor3 = Color3.fromRGB(133, 145, 255)
plus.Position = UDim2.new(0.231578946, 0, 0, 0)
plus.Size = UDim2.new(0, 45, 0, 28)
plus.Font = Enum.Font.SourceSans
plus.Text = "+"
plus.TextColor3 = Color3.fromRGB(0, 0, 0)
plus.TextScaled = true
plus.TextWrapped = true

speed.Name = "speed"
speed.Parent = Frame
speed.BackgroundColor3 = Color3.fromRGB(255, 85, 0)
speed.Position = UDim2.new(0.468421042, 0, 0.491228074, 0)
speed.Size = UDim2.new(0, 44, 0, 28)
speed.Font = Enum.Font.SourceSans
speed.Text = "1"
speed.TextColor3 = Color3.fromRGB(0, 0, 0)
speed.TextScaled = true
speed.TextWrapped = true

mine.Name = "mine"
mine.Parent = Frame
mine.BackgroundColor3 = Color3.fromRGB(123, 255, 247)
mine.Position = UDim2.new(0.231578946, 0, 0.491228074, 0)
mine.Size = UDim2.new(0, 45, 0, 29)
mine.Font = Enum.Font.SourceSans
mine.Text = "-"
mine.TextColor3 = Color3.fromRGB(0, 0, 0)
mine.TextScaled = true
mine.TextWrapped = true

closebutton.Name = "Close"
closebutton.Parent = Frame
closebutton.BackgroundColor3 = Color3.fromRGB(225, 25, 0)
closebutton.Font = Enum.Font.SourceSans
closebutton.Size = UDim2.new(0, 45, 0, 28)
closebutton.Text = "X"
closebutton.TextSize = 30
closebutton.Position = UDim2.new(0, 0, -1, 27)

mini.Name = "minimize"
mini.Parent = Frame
mini.BackgroundColor3 = Color3.fromRGB(192, 150, 230)
mini.Font = Enum.Font.SourceSans
mini.Size = UDim2.new(0, 45, 0, 28)
mini.Text = "-"
mini.TextSize = 40
mini.Position = UDim2.new(0, 44, -1, 27)

mini2.Name = "minimize2"
mini2.Parent = Frame
mini2.BackgroundColor3 = Color3.fromRGB(192, 150, 230)
mini2.Font = Enum.Font.SourceSans
mini2.Size = UDim2.new(0, 45, 0, 28)
mini2.Text = "+"
mini2.TextSize = 40
mini2.Position = UDim2.new(0, 44, -1, 57)
mini2.Visible = false

speeds = 1
local speaker = game:GetService("Players").LocalPlayer
nowe = false

game:GetService("StarterGui"):SetCore("SendNotification", { 
	Title = "FLY GUI V3";
	Text = "BY XNEO";
	Icon = "rbxthumb://type=Asset&id=5107182114&w=150&h=150"})
Duration = 5;

Frame.Active = true
Frame.Draggable = true

local flyAnimTrack
local idleAnimTrack

local FLY_ANIM_ID = "rbxassetid://282574440"
local IDLE_ANIM_ID = "rbxassetid://180435571" -- idle R6 mặc định

onof.MouseButton1Down:Connect(function()
	if nowe == true then
		nowe = false

		if flyAnimTrack then flyAnimTrack:Stop() flyAnimTrack = nil end
		if idleAnimTrack then idleAnimTrack:Stop() idleAnimTrack = nil end

		local hum = speaker.Character:FindFirstChildOfClass("Humanoid")
		for _,state in ipairs(Enum.HumanoidStateType:GetEnumItems()) do
			hum:SetStateEnabled(state,true)
		end
		hum:ChangeState(Enum.HumanoidStateType.RunningNoPhysics)
	else
		nowe = true

		local hum = speaker.Character:FindFirstChildOfClass("Humanoid")

		-- PLAY IDLE FLY ANIM (đứng yên trên không)
		local idleAnim = Instance.new("Animation")
		idleAnim.AnimationId = IDLE_ANIM_ID
		idleAnimTrack = hum:LoadAnimation(idleAnim)
		idleAnimTrack:Play()

		for i = 1, speeds do
			spawn(function()
				local hb = game:GetService("RunService").Heartbeat	
				tpwalking = true
				local chr = speaker.Character
				local hum = chr and chr:FindFirstChildWhichIsA("Humanoid")
				while tpwalking and hb:Wait() and chr and hum and hum.Parent do
					if hum.MoveDirection.Magnitude > 0 then
						chr:TranslateBy(hum.MoveDirection)
					end
				end
			end)
		end

		speaker.Character.Animate.Disabled = true
		for _,state in ipairs(Enum.HumanoidStateType:GetEnumItems()) do
			hum:SetStateEnabled(state,false)
		end
		hum:ChangeState(Enum.HumanoidStateType.Swimming)
	end

	-- 🔒 SCRIPT CHỈ DÀNH CHO R6
	local plr = speaker
	local torso = plr.Character.Torso
	local ctrl = {f = 0, b = 0, l = 0, r = 0}
	local lastctrl = {f = 0, b = 0, l = 0, r = 0}
	local maxspeed = 50
	local speedv = 0

	local bg = Instance.new("BodyGyro", torso)
	bg.P = 9e4
	bg.maxTorque = Vector3.new(9e9, 9e9, 9e9)
	bg.cframe = torso.CFrame

	local bv = Instance.new("BodyVelocity", torso)
	bv.velocity = Vector3.new(0,0.1,0)
	bv.maxForce = Vector3.new(9e9, 9e9, 9e9)

	if nowe == true then
		plr.Character.Humanoid.PlatformStand = true
	end

	while nowe == true or plr.Character.Humanoid.Health == 0 do
		game:GetService("RunService").RenderStepped:Wait()

		local hum = plr.Character.Humanoid
		local moving = hum.MoveDirection.Magnitude > 0

		-- 🎥 SWITCH ANIMATION & BODY ORIENTATION
		if moving then
			if idleAnimTrack then idleAnimTrack:Stop() idleAnimTrack = nil end
			if not flyAnimTrack then
				local anim = Instance.new("Animation")
				anim.AnimationId = FLY_ANIM_ID
				flyAnimTrack = hum:LoadAnimation(anim)
				flyAnimTrack:Play()
			end
		else
			if flyAnimTrack then flyAnimTrack:Stop() flyAnimTrack = nil end
			if not idleAnimTrack then
				local idleAnim = Instance.new("Animation")
				idleAnim.AnimationId = IDLE_ANIM_ID
				idleAnimTrack = hum:LoadAnimation(idleAnim)
				idleAnimTrack:Play()
			end
		end

		if ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0 then
			speedv = speedv + .5 + (speedv / maxspeed)
			if speedv > maxspeed then speedv = maxspeed end
		elseif speedv ~= 0 then
			speedv = speedv - 1
			if speedv < 0 then speedv = 0 end
		end

		if (ctrl.l + ctrl.r) ~= 0 or (ctrl.f + ctrl.b) ~= 0 then
			bv.velocity = ((workspace.CurrentCamera.CoordinateFrame.lookVector * (ctrl.f + ctrl.b)) +
				((workspace.CurrentCamera.CoordinateFrame * CFrame.new(ctrl.l + ctrl.r, (ctrl.f + ctrl.b) * .2, 0).p)
				 - workspace.CurrentCamera.CoordinateFrame.p)) * speedv
			lastctrl = {f = ctrl.f, b = ctrl.b, l = ctrl.l, r = ctrl.r}
		elseif speedv ~= 0 then
			bv.velocity = ((workspace.CurrentCamera.CoordinateFrame.lookVector * (lastctrl.f + lastctrl.b)) +
				((workspace.CurrentCamera.CoordinateFrame * CFrame.new(lastctrl.l + lastctrl.r, (lastctrl.f + lastctrl.b) * .2, 0).p)
				 - workspace.CurrentCamera.CoordinateFrame.p)) * speedv
		else
			bv.velocity = Vector3.new(0,0,0)
		end

		-- 🧍‍♂️ THÂN XOAY THEO TRẠNG THÁI
		if moving then
			-- Bay + di chuyển → thân nằm ngang, úp xuống, nhìn về trước
			bg.cframe = workspace.CurrentCamera.CoordinateFrame * CFrame.Angles(-math.rad(90), 0, 0)
		else
			-- Bay nhưng đứng yên → thân đứng bình thường
			bg.cframe = workspace.CurrentCamera.CoordinateFrame
		end
	end

	bg:Destroy()
	bv:Destroy()
	plr.Character.Humanoid.PlatformStand = false
	speaker.Character.Animate.Disabled = false
	tpwalking = false
end)

-- UP / DOWN BUTTON
local tis
up.MouseButton1Down:Connect(function()
	tis = up.MouseEnter:Connect(function()
		while tis do
			wait()
			speaker.Character.HumanoidRootPart.CFrame *= CFrame.new(0,1,0)
		end
	end)
end)
up.MouseLeave:Connect(function()
	if tis then tis:Disconnect() tis = nil end
end)

local dis
down.MouseButton1Down:Connect(function()
	dis = down.MouseEnter:Connect(function()
		while dis do
			wait()
			speaker.Character.HumanoidRootPart.CFrame *= CFrame.new(0,-1,0)
		end
	end)
end)
down.MouseLeave:Connect(function()
	if dis then dis:Disconnect() dis = nil end
end)

game.Players.LocalPlayer.CharacterAdded:Connect(function()
	wait(0.7)
	speaker.Character.Humanoid.PlatformStand = false
	speaker.Character.Animate.Disabled = false
end)

plus.MouseButton1Down:Connect(function()
	speeds = speeds + 1
	speed.Text = speeds
	if nowe == true then
		tpwalking = false
		for i = 1, speeds do
			spawn(function()
				local hb = game:GetService("RunService").Heartbeat	
				tpwalking = true
				local chr = speaker.Character
				local hum = chr and chr:FindFirstChildWhichIsA("Humanoid")
				while tpwalking and hb:Wait() and chr and hum and hum.Parent do
					if hum.MoveDirection.Magnitude > 0 then
						chr:TranslateBy(hum.MoveDirection)
					end
				end
			end)
		end
	end
end)

mine.MouseButton1Down:Connect(function()
	if speeds == 1 then
		speed.Text = "cannot be less than 1"
		wait(1)
		speed.Text = speeds
	else
		speeds = speeds - 1
		speed.Text = speeds
		if nowe == true then
			tpwalking = false
			for i = 1, speeds do
				spawn(function()
					local hb = game:GetService("RunService").Heartbeat	
					tpwalking = true
					local chr = speaker.Character
					local hum = chr and chr:FindFirstChildWhichIsA("Humanoid")
					while tpwalking and hb:Wait() and chr and hum and hum.Parent do
						if hum.MoveDirection.Magnitude > 0 then
							chr:TranslateBy(hum.MoveDirection)
						end
					end
				end)
			end
		end
	end
end)

closebutton.MouseButton1Click:Connect(function()
	main:Destroy()
end)

mini.MouseButton1Click:Connect(function()
	up.Visible = false
	down.Visible = false
	onof.Visible = false
	plus.Visible = false
	speed.Visible = false
	mine.Visible = false
	mini.Visible = false
	mini2.Visible = true
	Frame.BackgroundTransparency = 1
	closebutton.Position = UDim2.new(0, 0, -1, 57)
end)

mini2.MouseButton1Click:Connect(function()
	up.Visible = true
	down.Visible = true
	onof.Visible = true
	plus.Visible = true
	speed.Visible = true
	mine.Visible = true
	mini.Visible = true
	mini2.Visible = false
	Frame.BackgroundTransparency = 0
	closebutton.Position = UDim2.new(0, 0, -1, 27)
end)

Features & Information

đây là script mà tui lấy từ fly gui v3 rổi chỉnh thêm animation(lưu ý animation chỉ hoạt động r6)

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts