-- LocalScript -- Boost Button Rounded + Animated In/Out + Lightning Particle on Feet local Players = game:GetService("Players") local RunService = game:GetService("RunService") local TweenService = game:GetService("TweenService") local UserInputService = game:GetService("UserInputService") local SoundService = game:GetService("SoundService") local player = Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local humanoid = character:WaitForChild("Humanoid") local root = character:WaitForChild("HumanoidRootPart") -- Cari part kaki, fallback ke root local leftFoot = character:FindFirstChild("LeftFoot") local rightFoot = character:FindFirstChild("RightFoot") -- === Konfigurasi awal === local BASE_MAX_SPEED = 100 local BASE_ACCEL = 60 local BASE_FRICTION = 100 local FRICTION_SCALE = 10 local TURN_SMOOTHNESS = 5 local ROTATE_SPEED = 20 -- Boost config local BOOST_MULTIPLIER = 10 local BOOST_ACCEL_MULTIPLIER = 10 local BOOST_COOLDOWN = 5 -- detik -- Variabel runtime local MAX_SPEED = BASE_MAX_SPEED local ACCELERATION = BASE_ACCEL local currentSpeed = 0 local moveVector = Vector3.new(0,0,1) local canBoost = true local cooldownActive = false -- Nonaktifkan kontrol default humanoid.WalkSpeed = 0 humanoid.AutoRotate = false -- === GUI BOOST === local screenGui = Instance.new("ScreenGui", player:WaitForChild("PlayerGui")) local boostButton = Instance.new("TextButton") boostButton.Size = UDim2.new(0, 200, 0, 50) boostButton.Position = UDim2.new(0.5, -100, 1, 0) -- start di bawah layar boostButton.BackgroundColor3 = Color3.fromRGB(0,0,0) boostButton.TextColor3 = Color3.new(1,1,1) boostButton.TextScaled = true boostButton.Text = "BOOST!" boostButton.BackgroundTransparency = 1 -- start invisible boostButton.Parent = screenGui -- Biar bundar local corner = Instance.new("UICorner") corner.CornerRadius = UDim.new(0, 20) -- radius bundar corner.Parent = boostButton -- Bar cooldown local cooldownBar = Instance.new("Frame") cooldownBar.Size = UDim2.new(0,200,0,10) cooldownBar.Position = UDim2.new(0.5, -100, 0.8, 55) cooldownBar.BackgroundColor3 = Color3.fromRGB(80,80,80) cooldownBar.BorderSizePixel = 0 cooldownBar.Visible = false cooldownBar.Parent = screenGui local barFill = Instance.new("Frame") barFill.Size = UDim2.new(1,0,1,0) barFill.BackgroundColor3 = Color3.fromRGB(200, 50, 50) -- merah barFill.BorderSizePixel = 0 barFill.Parent = cooldownBar local timerLabel = Instance.new("TextLabel") timerLabel.Size = UDim2.new(0,200,0,30) timerLabel.Position = UDim2.new(0.5, -100, 0.8, 70) timerLabel.BackgroundTransparency = 1 timerLabel.TextColor3 = Color3.new(1,1,1) timerLabel.TextScaled = true timerLabel.Text = "" timerLabel.Visible = false timerLabel.Parent = screenGui -- Animasi Fade + Slide local function animateIn() boostButton.Visible = true local tween = TweenService:Create( boostButton, TweenInfo.new(0.6, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Position = UDim2.new(0.5, -100, 0.8, 0), BackgroundTransparency = 0} ) tween:Play() end local function animateOut() local tween = TweenService:Create( boostButton, TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.In), {Position = UDim2.new(0.5, -100, 1, 0), BackgroundTransparency = 1} ) tween:Play() tween.Completed:Connect(function() boostButton.Visible = false end) end -- Flash efek local flash = Instance.new("Frame") flash.Size = UDim2.new(1,0,1,0) flash.BackgroundColor3 = Color3.fromRGB(255, 255, 0) flash.BackgroundTransparency = 1 flash.ZIndex = 10 flash.Parent = screenGui -- Sound efek local boostSound = Instance.new("Sound") boostSound.SoundId = "rbxassetid://120714138513879" -- contoh sound boostSound.Volume = 1 boostSound.Parent = SoundService local function playFlash() flash.BackgroundTransparency = 0.2 local tween = TweenService:Create( flash, TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundTransparency = 1} ) tween:Play() end -- === BOOST FUNCTION === local function activateBoost() if not canBoost or cooldownActive then return end canBoost = false cooldownActive = true animateOut() -- Efek boost MAX_SPEED = BASE_MAX_SPEED * BOOST_MULTIPLIER ACCELERATION = BASE_ACCEL * BOOST_ACCEL_MULTIPLIER -- FX boostSound:Play() playFlash() -- === Cooldown UI === cooldownBar.Visible = true timerLabel.Visible = true barFill.Size = UDim2.new(1,0,1,0) local cooldownTime = BOOST_COOLDOWN local startTime = tick() task.spawn(function() while tick() - startTime < cooldownTime do local remaining = math.ceil(cooldownTime - (tick() - startTime)) timerLabel.Text = tostring(remaining).."s" barFill.Size = UDim2.new((cooldownTime - (tick() - startTime)) / cooldownTime, 0, 1, 0) RunService.RenderStepped:Wait() end -- Reset UI timerLabel.Visible = false cooldownBar.Visible = false canBoost = true cooldownActive = false animateIn() end) end boostButton.MouseButton1Click:Connect(activateBoost) UserInputService.InputBegan:Connect(function(input, gp) if gp then return end if input.KeyCode == Enum.KeyCode.B then activateBoost() end end) -- === PARTICLE LIGHTNING SETUP === local function createLightningParticle() local particle = Instance.new("ParticleEmitter") particle.Name = "LightningParticle" particle.Texture = "rbxassetid://348501325" -- tekstur petir particle.LightEmission = 1 particle.Color = ColorSequence.new(Color3.fromRGB(255, 255, 255), Color3.fromRGB(128, 128, 255)) particle.Rate = 15 particle.Lifetime = NumberRange.new(0.2, 0.4) particle.Speed = NumberRange.new(0, 0) particle.Rotation = NumberRange.new(0, 360) particle.RotSpeed = NumberRange.new(-180, 180) particle.Size = NumberSequence.new({NumberSequenceKeypoint.new(0, 0.5), NumberSequenceKeypoint.new(1, 0)}) particle.Transparency = NumberSequence.new({NumberSequenceKeypoint.new(0, 0), NumberSequenceKeypoint.new(1, 1)}) particle.LockedToPart = true particle.EmissionDirection = Enum.NormalId.Bottom return particle end -- Pasang particle ke kaki, fallback ke HumanoidRootPart if leftFoot and rightFoot then local leftParticle = createLightningParticle() leftParticle.Parent = leftFoot local rightParticle = createLightningParticle() rightParticle.Parent = rightFoot else -- Kalau nggak ada kaki, pasang ke HumanoidRootPart local fallbackParticle = createLightningParticle() fallbackParticle.Parent = root end -- === MOVEMENT LOOP === RunService.RenderStepped:Connect(function(dt) local inputDir = humanoid.MoveDirection if inputDir.Magnitude > 0 then -- Percepat currentSpeed = math.min(currentSpeed + ACCELERATION * dt, MAX_SPEED) moveVector = moveVector:Lerp(inputDir.Unit, TURN_SMOOTHNESS * dt).Unit else -- Reset accel & max speed ke nilai awal MAX_SPEED = BASE_MAX_SPEED ACCELERATION = BASE_ACCEL -- Gesekan local dynamicFriction = BASE_FRICTION + (currentSpeed / FRICTION_SCALE) * 20 currentSpeed = math.max(currentSpeed - dynamicFriction * dt, 0) end -- Kalau masih ada speed → tetap jalan if currentSpeed > 0 and moveVector.Magnitude > 0 then root.AssemblyLinearVelocity = Vector3.new( moveVector.X * currentSpeed, root.AssemblyLinearVelocity.Y, moveVector.Z * currentSpeed ) -- Rotasi ke arah movement local lookDir = Vector3.new(moveVector.X, 0, moveVector.Z).Unit local targetCFrame = CFrame.lookAt(root.Position, root.Position + lookDir) root.CFrame = root.CFrame:Lerp(targetCFrame, ROTATE_SPEED * dt) else -- Tetap kasih friction stop root.AssemblyLinearVelocity = Vector3.new( 0, root.AssemblyLinearVelocity.Y, 0 ) end end) -- Pertama kali animasi masuk animateIn()