
Key Required VerifiedUniversal

-- LocalScript (StarterPlayerScripts)
-- === Services ===
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
-- === Player and GUI Setup ===
local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local gui = Instance.new("ScreenGui")
gui.Name = "EgorToggle"
gui.ResetOnSpawn = false
gui.Parent = playerGui
-- Create a frame to hold the button
local backgroundFrame = Instance.new("Frame")
backgroundFrame.Name = "ButtonFrame"
backgroundFrame.Size = UDim2.new(0, 160, 0, 70)
backgroundFrame.Position = UDim2.new(0, 10, 1, -80)
backgroundFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
backgroundFrame.BorderSizePixel = 0
backgroundFrame.Parent = gui
-- Add a rounded corner to the frame
local frameCorner = Instance.new("UICorner")
frameCorner.CornerRadius = UDim.new(0, 10)
frameCorner.Parent = backgroundFrame
-- Add a subtle border effect
local frameStroke = Instance.new("UIStroke")
frameStroke.Color = Color3.fromRGB(200, 200, 200)
frameStroke.Thickness = 1
frameStroke.Transparency = 0.5
frameStroke.Parent = backgroundFrame
-- Create the button inside the frame
local button = Instance.new("TextButton")
button.Name = "Toggle"
button.Size = UDim2.new(1, -20, 1, -20)
button.Position = UDim2.new(0, 10, 0, 10)
button.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
button.BorderSizePixel = 0
button.TextColor3 = Color3.new(1, 1, 1)
button.TextSize = 20
button.Font = Enum.Font.SourceSansBold
button.Text = "Egor: OFF"
button.Parent = backgroundFrame
-- Add a rounded corner to the button
local buttonCorner = Instance.new("UICorner")
buttonCorner.CornerRadius = UDim.new(0, 8)
buttonCorner.Parent = button
-- === State Variables ===
local egorEnabled = false
local runAnimId = "rbxassetid://913376220" -- Roblox default run
local runTrack = nil
local runConnection = nil
-- Tweening variables for visual feedback
local tweenInfo = TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local offColor = Color3.fromRGB(50, 50, 50)
local onColor = Color3.fromRGB(80, 200, 80) -- A bright green for "ON"
-- === Setup Run Animation ===
local function playRunAnimation(humanoid)
local animator = humanoid:FindFirstChildWhichIsA("Animator")
if not animator then
animator = Instance.new("Animator", humanoid)
end
-- Stop any previous animation tracks
if runTrack then
runTrack:Stop()
runTrack:Destroy()
runTrack = nil
end
if runConnection then
runConnection:Disconnect()
runConnection = nil
end
-- Load run animation manually
local runAnim = Instance.new("Animation")
runAnim.AnimationId = runAnimId
runTrack = animator:LoadAnimation(runAnim)
runTrack.Priority = Enum.AnimationPriority.Movement
-- The corrected logic: Play the animation and then handle speed in the loop
runTrack:Play()
-- Monitor player movement every frame
runConnection = RunService.RenderStepped:Connect(function()
if humanoid.MoveDirection.Magnitude == 0 then
-- Stop when not moving
if runTrack.IsPlaying then
runTrack:Stop()
end
else
-- Play and adjust speed when moving
if not runTrack.IsPlaying then
runTrack:Play()
end
-- CRUCIAL FIX: Always adjust the speed when the player is moving.
-- This ensures the fast visual effect is consistently applied
-- and doesn't get overwritten by the default walkspeed.
runTrack:AdjustSpeed(6)
end
end)
end
local function stopRunAnimation()
if runTrack then
runTrack:Stop()
runTrack:Destroy() -- Clean up the animation track
runTrack = nil
end
if runConnection then
runConnection:Disconnect()
runConnection = nil
end
end
-- === Toggle Egor Mode ===
local function enableEgor()
local char = player.Character
if not char then return end
local humanoid = char:FindFirstChild("Humanoid")
if not humanoid then return end
humanoid.WalkSpeed = 3
playRunAnimation(humanoid)
button.Text = "Egor: ON"
-- Tween button color to green
TweenService:Create(button, tweenInfo, {BackgroundColor3 = onColor}):Play()
end
local function disableEgor()
local char = player.Character
if not char then return end
local humanoid = char:FindFirstChild("Humanoid")
if not humanoid then return end
humanoid.WalkSpeed = 16
stopRunAnimation()
button.Text = "Egor: OFF"
-- Tween button color back to gray
TweenService:Create(button, tweenInfo, {BackgroundColor3 = offColor}):Play()
end
-- === Button Toggle ===
button.MouseButton1Click:Connect(function()
egorEnabled = not egorEnabled
if egorEnabled then
enableEgor()
else
disableEgor()
end
end)
-- === On Character Spawn ===
local function onCharacterAdded(char)
local humanoid = char:WaitForChild("Humanoid")
char:WaitForChild("Animate") -- Wait for the default animation script
task.wait(0.5)
if egorEnabled then
enableEgor()
else
-- Ensure the character starts with the default speed if not enabled
humanoid.WalkSpeed = 16
end
end
-- Initial setup if the player's character already exists
if player.Character then
onCharacterAdded(player.Character)
end
-- Connect to the CharacterAdded event to handle respawns
player.CharacterAdded:Connect(onCharacterAdded)No comments yet for this script.


![Noob Avatar in Nds [OPEN SOURCE]](https://scriptblox.com/images/sb/rbx-7ea7065a02f8cff80f8b0270a9ad2d3b-0820ff9b1f88.png)
