make me a roblox ui settings deepwoken and ghoul://re type gui style and it is a…
- User
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
make me a roblox ui settings deepwoken and ghoul://re type gui style and it is a settings button in the left of the players screen. when u click it it gives u the option to enable autosprint so u dont have to double tap w to sprint and u can just press w to sprint only if autosprint is enabled --the script got changed a bit after the video so some lines are not 100% the same, keep that in mind
--||Services||-- local RS = game:GetService("ReplicatedStorage") local uis = game:GetService("UserInputService")
--||Variables||-- local plr = game.Players.LocalPlayer local char = plr.Character local hum = char:WaitForChild("Humanoid") local TS = game:GetService("TweenService") local camera = game.Workspace.CurrentCamera local isSprinting = false local debounce = false local lastKeyPressTime = 0
--||Settings||-- local runSpeed = 28 local walkSpeed = 18 local doubleTapTimeThreshold = 0.3 --the time "window" you have to double tap W to start sprinting, so you have 0.3 seconds to double press W and start sprinting
function shiftToSprint(SprintTrack) if isSprinting and not debounce then debounce = true
if not char:GetAttribute("Attacking") and not char:GetAttribute("Stunned") then hum.WalkSpeed = walkSpeed end --if we are not attacking and are not stunned we reset our walkspeed
TS:Create(camera, TweenInfo.new(.5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {FieldOfView = 70}):Play() --tweening the FOV
isSprinting = false
if SprintAnim then SprintAnim:Stop() end
char:SetAttribute("Sprinting", false)
task.wait(.5) -- so we can't spam sprint
debounce = false
elseif not isSprinting and debounce == false then
char:SetAttribute("Sprinting", true)
hum.WalkSpeed = runSpeed
TS:Create(camera, TweenInfo.new(.5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {FieldOfView = 70}):Play() --tweening the FOV
isSprinting = true
SprintAnim = hum.Animator:LoadAnimation(SprintTrack)
SprintAnim:Play()
end
end
function onKeyPress(inputObject, isTyping) if isTyping then return end if inputObject.KeyCode == Enum.KeyCode.W and not char:GetAttribute("Stunned") and not char:GetAttribute("IsRagdoll") and not char:GetAttribute("IsBlocking") and not char:GetAttribute("Attacking") then local currentTime = tick() if currentTime - lastKeyPressTime <= doubleTapTimeThreshold then -- Double-tap detected if char:FindFirstChildWhichIsA("Tool") and char:FindFirstChildWhichIsA("Tool"):GetAttribute("Type") == "Attack" then SprintTrack = RS.Animations.Weapons[char:FindFirstChildWhichIsA("Tool").Name].Movement.Sprint else SprintTrack = RS.Animations.Player.Main.Sprint end shiftToSprint(SprintTrack) end lastKeyPressTime = currentTime end end
function onKeyRelease(inputObject, isTyping) if isTyping then return end if inputObject.KeyCode == Enum.KeyCode.W and isSprinting then shiftToSprint() end end
uis.InputBegan:Connect(onKeyPress) uis.InputEnded:Connect(onKeyRelease)
hum.Changed:Connect(function() local stunned = char:GetAttribute("Stunned") local ragdoll = char:GetAttribute("IsRagdoll") local attacking = char:GetAttribute("Attacking")
if stunned or ragdoll or attacking or char.HumanoidRootPart.Anchored then
if isSprinting then shiftToSprint() end
end
end)
char.ChildAdded:Connect(function() if char:FindFirstChildWhichIsA("Tool") then if isSprinting then shiftToSprint() end --if we equip a tool and are sprinting we stop sprinting end end)
---------------------------------MOBILE------------------------------------
if uis.TouchEnabled then local MobileButtons = plr.PlayerGui:WaitForChild("MobileButtons"):WaitForChild("MobileButtons2")
MobileButtons.Sprint.Activated:Connect(function()
shiftToSprint()
end)
end
---------------------------------MOBILE------------------------------------
Below is a Roblox UI script that creates a settings button on the left side of the player's screen in the style of Deepwoken and Ghoul://re. The settings menu includes an option to enable AutoSprint, allowing players to sprint by simply pressing "W" once instead of double-tapping it. The script is based on the provided logic but adapted for the UI and AutoSprint functionality.
--||Services||--
local RS = game:GetService("ReplicatedStorage")
local uis = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local TS = game:GetService("TweenService")
local camera = workspace.CurrentCamera
--||UI Variables||--
local autoSprintEnabled = false
local settingsFrame = nil
--||Settings||--
local runSpeed = 28
local walkSpeed = 18
local isSprinting = false
local debounce = false
--||UI Creation Function||--
local function createSettingsUI()
if settingsFrame then settingsFrame:Destroy() end
settingsFrame = Instance.new("ScreenGui")
settingsFrame.Parent = plr.PlayerGui
settingsFrame.ResetOnSpawn = false
local settingsButton = Instance.new("ImageButton")
settingsButton.Name = "SettingsButton"
settingsButton.Parent = settingsFrame
settingsButton.AnchorPoint = Vector2.new(0, 0.5)
settingsButton.Position = UDim2.new(0.02, 0, 0.5, 0)
settingsButton.Size = UDim2.new(0.05, 0, 0.1, 0)
settingsButton.BackgroundTransparency = 0.5
settingsButton.Image = "rbxassetid://3577329776" -- Gear icon or similar
settingsButton.ZIndex = 10
local settingsMenu = Instance.new("Frame")
settingsMenu.Name = "SettingsMenu"
settingsMenu.Parent = settingsFrame
settingsMenu.AnchorPoint = Vector2.new(0, 0.5)
settingsMenu.Position = UDim2.new(0.08, 0, 0.5, 0)
settingsMenu.Size = UDim2.new(0.2, 0, 0.5, 0)
settingsMenu.BackgroundTransparency = 0.2
settingsMenu.Visible = false
settingsMenu.ZIndex = 9
local autoSprintToggle = Instance.new("TextButton")
autoSprintToggle.Name = "AutoSprintToggle"
autoSprintToggle.Parent = settingsMenu
autoSprintToggle.Size = UDim2.new(1, 0, 0.2, 0)
autoSprintToggle.Text = "AutoSprint: Off"
autoSprintToggle.TextColor3 = Color3.new(1, 1, 1)
autoSprintToggle.BackgroundColor3 = Color3.new(0.1, 0.1, 0.1)
autoSprintToggle.ZIndex = 10
autoSprintToggle.MouseButton1Click:Connect(function()
autoSprintEnabled = not autoSprintEnabled
autoSprintToggle.Text = "AutoSprint: " .. (autoSprintEnabled and "On" or "Off")
end)
settingsButton.MouseButton1Click:Connect(function()
settingsMenu.Visible = not settingsMenu.Visible
end)
end
--||Sprint Functionality||--
local function shiftToSprint()
if isSprinting and not debounce then
debounce = true
hum.WalkSpeed = walkSpeed
isSprinting = false
debounce = false
elseif not isSprinting and debounce == false then
hum.WalkSpeed = runSpeed
isSprinting = true
end
end
--||Input Handling||--
uis.InputBegan:Connect(function(inputObject, isTyping)
if isTyping then return end
if inputObject.KeyCode == Enum.KeyCode.W then
if autoSprintEnabled then
shiftToSprint()
else
local currentTime = tick()
if currentTime - lastKeyPressTime <= 0.3 then
shiftToSprint()
end
lastKeyPressTime = currentTime
end
end
end)
uis.InputEnded:Connect(function(inputObject, isTyping)
if isTyping then return end
if inputObject.KeyCode == Enum.KeyCode.W and isSprinting and not autoSprintEnabled then
shiftToSprint()
end
end)
--||Initialize UI||--
createSettingsUI()
--||Mobile Support (Optional)||
if uis.TouchEnabled then
local MobileButtons = plr.PlayerGui:WaitForChild("MobileButtons"):WaitForChild("MobileButtons2")
MobileButtons.Sprint.Activated:Connect(function()
if autoSprintEnabled then return end
shiftToSprint()
end)
end
make sure the autosprint always works when the player presses W and make the gui look better like deepwoken and ghoul re type styled
Here’s an updated version of the script with AutoSprint always active when enabled, and a Deepwoken/Ghoul://re styled GUI. The GUI is designed to look sleek, dark, and immersive, fitting the aesthetic of those games.
--||Services||--
local RS = game:GetService("ReplicatedStorage")
local uis = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local TS = game:GetService("TweenService")
local camera = workspace.CurrentCamera
--||UI Variables||--
local autoSprintEnabled = false
local settingsFrame = nil
local lastKeyPressTime = 0
local doubleTapTimeThreshold = 0.3
--||Settings||--
local runSpeed = 28
local walkSpeed = 18
local isSprinting = false
local debounce = false
--||UI Creation Function||--
local function createSettingsUI()
if settingsFrame then settingsFrame:Destroy() end
settingsFrame = Instance.new("ScreenGui")
settingsFrame.Parent = plr.PlayerGui
settingsFrame.ResetOnSpawn = false
-- Settings Button
local settingsButton = Instance.new("ImageButton")
settingsButton.Name = "SettingsButton"
settingsButton.Parent = settingsFrame
settingsButton.AnchorPoint = Vector2.new(0, 0.5)
settingsButton.Position = UDim2.new(0.02, 0, 0.5, 0)
settingsButton.Size = UDim2.new(0.05, 0, 0.1, 0)
settingsButton.BackgroundTransparency = 1
settingsButton.Image = "rbxassetid://3926305904" -- Deepwoken-style gear icon
settingsButton.ImageColor3 = Color3.new(0.8, 0.8, 0.8)
settingsButton.ZIndex = 10
-- Settings Menu
local settingsMenu = Instance.new("Frame")
settingsMenu.Name = "SettingsMenu"
settingsMenu.Parent = settingsFrame
settingsMenu.AnchorPoint = Vector2.new(0, 0.5)
settingsMenu.Position = UDim2.new(0.08, 0, 0.5, 0)
settingsMenu.Size = UDim2.new(0.2, 0, 0.4, 0)
settingsMenu.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
settingsMenu.BorderColor3 = Color3.fromRGB(50, 50, 50)
settingsMenu.BorderSizePixel = 0
settingsMenu.Visible = false
settingsMenu.ZIndex = 9
-- Title
local title = Instance.new("TextLabel")
title.Name = "Title"
title.Parent = settingsMenu
title.BackgroundTransparency = 1
title.Size = UDim2.new(1, 0, 0.2, 0)
title.Text = "Settings"
title.TextColor3 = Color3.new(0.9, 0.9, 0.9)
title.TextScaled = true
title.Font = Enum.Font.GothamBold
-- AutoSprint Toggle
local autoSprintToggle = Instance.new("TextButton")
autoSprintToggle.Name = "AutoSprintToggle"
autoSprintToggle.Parent = settingsMenu
autoSprintToggle.AnchorPoint = Vector2.new(0.5, 0)
autoSprintToggle.Position = UDim2.new(0.5, 0, 0.4, 0)
autoSprintToggle.Size = UDim2.new(0.8, 0, 0.15, 0)
autoSprintToggle.Text = "AutoSprint: Off"
autoSprintToggle.TextColor3 = Color3.new(0.9, 0.9, 0.9)
autoSprintToggle.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
autoSprintToggle.Font = Enum.Font.Gotham
autoSprintToggle.ZIndex = 10
autoSprintToggle.MouseEnter:Connect(function()
autoSprintToggle.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
end)
autoSprintToggle.MouseLeave:Connect(function()
autoSprintToggle.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
end)
autoSprintToggle.MouseButton1Click:Connect(function()
autoSprintEnabled = not autoSprintEnabled
autoSprintToggle.Text = "AutoSprint: " .. (autoSprintEnabled and "On" or "Off")
end)
-- Close Button
local closeButton = Instance.new("TextButton")
closeButton.Name = "CloseButton"
closeButton.Parent = settingsMenu
closeButton.AnchorPoint = Vector2.new(1, 0)
closeButton.Position = UDim2.new(1, -5, 0, 5)
closeButton.Size = UDim2.new(0.2, 0, 0.2, 0)
closeButton.Text = "X"
closeButton.TextColor3 = Color3.new(0.9, 0.9, 0.9)
closeButton.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
closeButton.Font = Enum.Font.GothamBold
closeButton.ZIndex = 10
closeButton.MouseEnter:Connect(function()
closeButton.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
end)
closeButton.MouseLeave:Connect(function()
closeButton.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
end)
closeButton.MouseButton1Click:Connect(function()
settingsMenu.Visible = false
end)
settingsButton.MouseButton1Click:Connect(function()
settingsMenu.Visible = not settingsMenu.Visible
end)
end
--||Sprint Functionality||--
local function shiftToSprint()
if autoSprintEnabled and not debounce then
debounce = true
if isSprinting then
hum.WalkSpeed = walkSpeed
isSprinting = false
else
hum.WalkSpeed = runSpeed
isSprinting = true
end
debounce = false
end
end
--||Input Handling||--
uis.InputBegan:Connect(function(inputObject, isTyping)
if isTyping then return end
if inputObject.KeyCode == Enum.KeyCode.W then
if autoSprintEnabled then
shiftToSprint()
else
local currentTime = tick()
if currentTime - lastKeyPressTime <= doubleTapTimeThreshold then
shiftToSprint()
end
lastKeyPressTime = currentTime
end
end
end)
uis.InputEnded:Connect(function(inputObject, isTyping)
if isTyping then return end
if inputObject.KeyCode == Enum.KeyCode.W and not autoSprintEnabled and isSprinting then
hum.WalkSpeed = walkSpeed
isSprinting = false
end
end)
--||Initialize UI||--
createSettingsUI()
for some reason it isnt playing the sprint animation and sometimes when i press w it just walks when i have autosprint enabled
The issue likely stems from missing animation handling and inconsistent sprint toggling. Below is the updated and corrected script that ensures the sprint animation plays and AutoSprint works reliably. I’ve also added animation handling and debounce logic to prevent glitches.
--||Services||--
local RS = game:GetService("ReplicatedStorage")
local uis = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local animator = hum:WaitForChild("Animator")
local TS = game:GetService("TweenService")
local camera = workspace.CurrentCamera
--||Animation Variables||--
local SprintAnimTrack = nil
local SprintAnim = nil
--||UI Variables||--
local autoSprintEnabled = false
local settingsFrame = nil
local lastKeyPressTime = 0
local doubleTapTimeThreshold = 0.3
--||Settings||--
local runSpeed = 28
local walkSpeed = 18
local isSprinting = false
local debounce = false
--||UI Creation Function||--
local function createSettingsUI()
if settingsFrame then settingsFrame:Destroy() end
settingsFrame = Instance.new("ScreenGui")
settingsFrame.Parent = plr.PlayerGui
settingsFrame.ResetOnSpawn = false
-- Settings Button
local settingsButton = Instance.new("ImageButton")
settingsButton.Name = "SettingsButton"
settingsButton.Parent = settingsFrame
settingsButton.AnchorPoint = Vector2.new(0, 0.5)
settingsButton.Position = UDim2.new(0.02, 0, 0.5, 0)
settingsButton.Size = UDim2.new(0.05, 0, 0.1, 0)
settingsButton.BackgroundTransparency = 1
settingsButton.Image = "rbxassetid://3926305904" -- Deepwoken-style gear icon
settingsButton.ImageColor3 = Color3.new(0.8, 0.8, 0.8)
settingsButton.ZIndex = 10
-- Settings Menu
local settingsMenu = Instance.new("Frame")
settingsMenu.Name = "SettingsMenu"
settingsMenu.Parent = settingsFrame
settingsMenu.AnchorPoint = Vector2.new(0, 0.5)
settingsMenu.Position = UDim2.new(0.08, 0, 0.5, 0)
settingsMenu.Size = UDim2.new(0.2, 0, 0.4, 0)
settingsMenu.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
settingsMenu.BorderColor3 = Color3.fromRGB(50, 50, 50)
settingsMenu.BorderSizePixel = 0
settingsMenu.Visible = false
settingsMenu.ZIndex = 9
-- Title
local title = Instance.new("TextLabel")
title.Name = "Title"
title.Parent = settingsMenu
title.BackgroundTransparency = 1
title.Size = UDim2.new(1, 0, 0.2, 0)
title.Text = "Settings"
title.TextColor3 = Color3.new(0.9, 0.9, 0.9)
title.TextScaled = true
title.Font = Enum.Font.GothamBold
-- AutoSprint Toggle
local autoSprintToggle = Instance.new("TextButton")
autoSprintToggle.Name = "AutoSprintToggle"
autoSprintToggle.Parent = settingsMenu
autoSprintToggle.AnchorPoint = Vector2.new(0.5, 0)
autoSprintToggle.Position = UDim2.new(0.5, 0, 0.4, 0)
autoSprintToggle.Size = UDim2.new(0.8, 0, 0.15, 0)
autoSprintToggle.Text = "AutoSprint: Off"
autoSprintToggle.TextColor3 = Color3.new(0.9, 0.9, 0.9)
autoSprintToggle.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
autoSprintToggle.Font = Enum.Font.Gotham
autoSprintToggle.ZIndex = 10
autoSprintToggle.MouseEnter:Connect(function()
autoSprintToggle.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
end)
autoSprintToggle.MouseLeave:Connect(function()
autoSprintToggle.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
end)
autoSprintToggle.MouseButton1Click:Connect(function()
autoSprintEnabled = not autoSprintEnabled
autoSprintToggle.Text = "AutoSprint: " .. (autoSprintEnabled and "On" or "Off")
end)
-- Close Button
local closeButton = Instance.new("TextButton")
closeButton.Name = "CloseButton"
closeButton.Parent = settingsMenu
closeButton.AnchorPoint = Vector2.new(1, 0)
closeButton.Position = UDim2.new(1, -5, 0, 5)
closeButton.Size = UDim2.new(0.2, 0, 0.2, 0)
closeButton.Text = "X"
closeButton.TextColor3 = Color3.new(0.9, 0.9, 0.9)
closeButton.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
closeButton.Font = Enum.Font.GothamBold
closeButton.ZIndex = 10
closeButton.MouseEnter:Connect(function()
closeButton.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
end)
closeButton.MouseLeave:Connect(function()
closeButton.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
end)
closeButton.MouseButton1Click:Connect(function()
settingsMenu.Visible = false
end)
settingsButton.MouseButton1Click:Connect(function()
settingsMenu.Visible = not settingsMenu.Visible
end)
end
--||Sprint Functionality||--
local function loadSprintAnimation()
if SprintAnim then SprintAnim:Stop() end
SprintAnimTrack = RS.Animations.Player.Main.Sprint -- Replace with your sprint animation path
SprintAnim = animator:LoadAnimation(SprintAnimTrack)
end
local function toggleSprint()
if debounce then return end
debounce = true
if isSprinting then
hum.WalkSpeed = walkSpeed
if SprintAnim and SprintAnim.IsPlaying then
SprintAnim:Stop()
end
isSprinting = false
else
hum.WalkSpeed = runSpeed
loadSprintAnimation()
if SprintAnim then
SprintAnim:Play()
end
isSprinting = true
end
debounce = false
end
--||Input Handling||--
uis.InputBegan:Connect(function(inputObject, isTyping)
if isTyping then return end
if inputObject.KeyCode == Enum.KeyCode.W then
if autoSprintEnabled then
toggleSprint()
else
local currentTime = tick()
if currentTime - lastKeyPressTime <= doubleTapTimeThreshold then
toggleSprint()
end
lastKeyPressTime = currentTime
end
end
end)
uis.InputEnded:Connect(function(inputObject, isTyping)
if isTyping then return end
if inputObject.KeyCode == Enum.KeyCode.W and not autoSprintEnabled and isSprinting then
toggleSprint()
end
end)
--||Initialize UI & Animation||--
createSettingsUI()
loadSprintAnimation() -- Preload the sprint animation
make sure the sprint animation stops when the player stops holding w, and make sure this autosprint works everytime a player presses w
Here’s the final updated script that ensures the sprint animation stops when the player stops holding "W" and that AutoSprint works reliably every time "W" is pressed. I’ve also added additional checks to ensure smooth behavior.
--||Services||--
local RS = game:GetService("ReplicatedStorage")
local uis = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local animator = hum:WaitForChild("Animator")
local TS = game:GetService("TweenService")
local camera = workspace.CurrentCamera
--||Animation Variables||--
local SprintAnimTrack = RS.Animations.Player.Main.Sprint -- Replace with your sprint animation path
local SprintAnim = nil
--||UI Variables||--
local autoSprintEnabled = false
local settingsFrame = nil
local lastKeyPressTime = 0
local doubleTapTimeThreshold = 0.3
local isWPressed = false
--||Settings||--
local runSpeed = 28
local walkSpeed = 18
local isSprinting = false
local debounce = false
--||UI Creation Function||--
local function createSettingsUI()
if settingsFrame then settingsFrame:Destroy() end
settingsFrame = Instance.new("ScreenGui")
settingsFrame.Parent = plr.PlayerGui
settingsFrame.ResetOnSpawn = false
-- Settings Button
local settingsButton = Instance.new("ImageButton")
settingsButton.Name = "SettingsButton"
settingsButton.Parent = settingsFrame
settingsButton.AnchorPoint = Vector2.new(0, 0.5)
settingsButton.Position = UDim2.new(0.02, 0, 0.5, 0)
settingsButton.Size = UDim2.new(0.05, 0, 0.1, 0)
settingsButton.BackgroundTransparency = 1
settingsButton.Image = "rbxassetid://3926305904" -- Deepwoken-style gear icon
settingsButton.ImageColor3 = Color3.new(0.8, 0.8, 0.8)
settingsButton.ZIndex = 10
-- Settings Menu
local settingsMenu = Instance.new("Frame")
settingsMenu.Name = "SettingsMenu"
settingsMenu.Parent = settingsFrame
settingsMenu.AnchorPoint = Vector2.new(0, 0.5)
settingsMenu.Position = UDim2.new(0.08, 0, 0.5, 0)
settingsMenu.Size = UDim2.new(0.2, 0, 0.4, 0)
settingsMenu.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
settingsMenu.BorderColor3 = Color3.fromRGB(50, 50, 50)
settingsMenu.BorderSizePixel = 0
settingsMenu.Visible = false
settingsMenu.ZIndex = 9
-- Title
local title = Instance.new("TextLabel")
title.Name = "Title"
title.Parent = settingsMenu
title.BackgroundTransparency = 1
title.Size = UDim2.new(1, 0, 0.2, 0)
title.Text = "Settings"
title.TextColor3 = Color3.new(0.9, 0.9, 0.9)
title.TextScaled = true
title.Font = Enum.Font.GothamBold
-- AutoSprint Toggle
local autoSprintToggle = Instance.new("TextButton")
autoSprintToggle.Name = "AutoSprintToggle"
autoSprintToggle.Parent = settingsMenu
autoSprintToggle.AnchorPoint = Vector2.new(0.5, 0)
autoSprintToggle.Position = UDim2.new(0.5, 0, 0.4, 0)
autoSprintToggle.Size = UDim2.new(0.8, 0, 0.15, 0)
autoSprintToggle.Text = "AutoSprint: Off"
autoSprintToggle.TextColor3 = Color3.new(0.9, 0.9, 0.9)
autoSprintToggle.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
autoSprintToggle.Font = Enum.Font.Gotham
autoSprintToggle.ZIndex = 10
autoSprintToggle.MouseEnter:Connect(function()
autoSprintToggle.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
end)
autoSprintToggle.MouseLeave:Connect(function()
autoSprintToggle.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
end)
autoSprintToggle.MouseButton1Click:Connect(function()
autoSprintEnabled = not autoSprintEnabled
autoSprintToggle.Text = "AutoSprint: " .. (autoSprintEnabled and "On" or "Off")
end)
-- Close Button
local closeButton = Instance.new("TextButton")
closeButton.Name = "CloseButton"
closeButton.Parent = settingsMenu
closeButton.AnchorPoint = Vector2.new(1, 0)
closeButton.Position = UDim2.new(1, -5, 0, 5)
closeButton.Size = UDim2.new(0.2, 0, 0.2, 0)
closeButton.Text = "X"
closeButton.TextColor3 = Color3.new(0.9, 0.9, 0.9)
closeButton.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
closeButton.Font = Enum.Font.GothamBold
closeButton.ZIndex = 10
closeButton.MouseEnter:Connect(function()
closeButton.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
end)
closeButton.MouseLeave:Connect(function()
closeButton.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
end)
closeButton.MouseButton1Click:Connect(function()
settingsMenu.Visible = false
end)
settingsButton.MouseButton1Click:Connect(function()
settingsMenu.Visible = not settingsMenu.Visible
end)
end
--||Sprint Functionality||--
local function loadSprintAnimation()
if SprintAnim then SprintAnim:Stop() end
SprintAnim = animator:LoadAnimation(SprintAnimTrack)
end
local function toggleSprint(forceStop)
if debounce then return end
debounce = true
if forceStop or (isSprinting and not isWPressed) then
hum.WalkSpeed = walkSpeed
if SprintAnim and SprintAnim.IsPlaying then
SprintAnim:Stop()
end
isSprinting = false
elseif not isSprinting and isWPressed and (autoSprintEnabled or (tick() - lastKeyPressTime <= doubleTapTimeThreshold)) then
hum.WalkSpeed = runSpeed
loadSprintAnimation()
if SprintAnim then
SprintAnim:Play()
end
isSprinting = true
end
debounce = false
end
--||Input Handling||--
uis.InputBegan:Connect(function(inputObject, isTyping)
if isTyping then return end
if inputObject.KeyCode == Enum.KeyCode.W then
isWPressed = true
if autoSprintEnabled then
toggleSprint()
else
local currentTime = tick()
if currentTime - lastKeyPressTime <= doubleTapTimeThreshold then
toggleSprint()
end
lastKeyPressTime = currentTime
end
end
end)
uis.InputEnded:Connect(function(inputObject, isTyping)
if isTyping then return end
if inputObject.KeyCode == Enum.KeyCode.W then
isWPressed = false
toggleSprint(true) -- Force stop sprinting when W is released
end
end)
--||Initialize UI & Animation||--
createSettingsUI()
loadSprintAnimation() -- Preload the sprint animation
make sure if the player has autosprint enabled or disabled it saves everytime they leave and rejoin or respawn, and make the gui look better like deepwoken or strongest battlegrounds topbar gui
Below is the updated script with save/load functionality for AutoSprint and a Deepwoken/Strongest Battlegrounds-inspired GUI for the topbar. The GUI is styled to look sleek, modern, and immersive.
--||Services||--
local RS = game:GetService("ReplicatedStorage")
local uis = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local animator = hum:WaitForChild("Animator")
local TS = game:GetService("TweenService")
local camera = workspace.CurrentCamera
local DataStoreService = game:GetService("DataStoreService")
local AutoSprintDS = DataStoreService:GetDataStore("AutoSprintSettings")
--||Animation Variables||--
local SprintAnimTrack = RS.Animations.Player.Main.Sprint -- Replace with your sprint animation path
local SprintAnim = nil
--||UI Variables||--
local autoSprintEnabled = false
local settingsFrame = nil
local lastKeyPressTime = 0
local doubleTapTimeThreshold = 0.3
local isWPressed = false
--||Settings||--
local runSpeed = 28
local walkSpeed = 18
local isSprinting = false
local debounce = false
--||Save/Load AutoSprint Setting||--
local function saveAutoSprintSetting()
local success, err = pcall(function()
AutoSprintDS:SetAsync(plr.UserId, autoSprintEnabled)
end)
if not success then
warn("Failed to save AutoSprint setting:", err)
end
end
local function loadAutoSprintSetting()
local success, result = pcall(function()
return AutoSprintDS:GetAsync(plr.UserId)
end)
if success then
autoSprintEnabled = result or false
else
warn("Failed to load AutoSprint setting:", result)
end
end
--||Sprint Functionality||--
local function loadSprintAnimation()
if SprintAnim then SprintAnim:Stop() end
SprintAnim = animator:LoadAnimation(SprintAnimTrack)
end
local function toggleSprint(forceStop)
if debounce then return end
debounce = true
if forceStop or (isSprinting and not isWPressed) then
hum.WalkSpeed = walkSpeed
if SprintAnim and SprintAnim.IsPlaying then
SprintAnim:Stop()
end
isSprinting = false
elseif not isSprinting and isWPressed and (autoSprintEnabled or (tick() - lastKeyPressTime <= doubleTapTimeThreshold)) then
hum.WalkSpeed = runSpeed
loadSprintAnimation()
if SprintAnim then
SprintAnim:Play()
end
isSprinting = true
end
debounce = false
end
--||Topbar GUI Creation||--
local function createTopbarGUI()
local topbar = Instance.new("ScreenGui")
topbar.Name = "TopbarGUI"
topbar.Parent = plr.PlayerGui
topbar.ResetOnSpawn = false
local barFrame = Instance.new("Frame")
barFrame.Name = "BarFrame"
barFrame.Parent = topbar
barFrame.AnchorPoint = Vector2.new(0.5, 0)
barFrame.Position = UDim2.new(0.5, 0, 0, 5)
barFrame.Size = UDim2.new(0.8, 0, 0.05, 0)
barFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
barFrame.BorderColor3 = Color3.fromRGB(50, 50, 50)
barFrame.BorderSizePixel = 0
local autoSprintButton = Instance.new("TextButton")
autoSprintButton.Name = "AutoSprintButton"
autoSprintButton.Parent = barFrame
autoSprintButton.AnchorPoint = Vector2.new(0, 0.5)
autoSprintButton.Position = UDim2.new(0, 5, 0.5, 0)
autoSprintButton.Size = UDim2.new(0.1, 0, 1, 0)
autoSprintButton.Text = "AutoSprint: " .. (autoSprintEnabled and "On" or "Off")
autoSprintButton.TextColor3 = Color3.new(0.9, 0.9, 0.9)
autoSprintButton.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
autoSprintButton.Font = Enum.Font.Gotham
autoSprintButton.ZIndex = 10
autoSprintButton.MouseEnter:Connect(function()
autoSprintButton.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
end)
autoSprintButton.MouseLeave:Connect(function()
autoSprintButton.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
end)
autoSprintButton.MouseButton1Click:Connect(function()
autoSprintEnabled = not autoSprintEnabled
autoSprintButton.Text = "AutoSprint: " .. (autoSprintEnabled and "On" or "Off")
saveAutoSprintSetting()
end)
return topbar
end
--||Input Handling||--
uis.InputBegan:Connect(function(inputObject, isTyping)
if isTyping then return end
if inputObject.KeyCode == Enum.KeyCode.W then
isWPressed = true
if autoSprintEnabled then
toggleSprint()
else
local currentTime = tick()
if currentTime - lastKeyPressTime <= doubleTapTimeThreshold then
toggleSprint()
end
lastKeyPressTime = currentTime
end
end
end)
uis.InputEnded:Connect(function(inputObject, isTyping)
if isTyping then return end
if inputObject.KeyCode == Enum.KeyCode.W then
isWPressed = false
toggleSprint(true) -- Force stop sprinting when W is released
end
end)
--||Initialize UI, Animation, and Settings||--
loadAutoSprintSetting()
createTopbarGUI()
loadSprintAnimation()
--||Save Settings on Player Leaving||--
plr.CharacterRemoving:Connect(function()
saveAutoSprintSetting()
end)
game.Players.PlayerRemoving:Connect(function()
saveAutoSprintSetting()
end)
UI Creation:
AutoSprint Functionality:
Styling:
Mobile Support:
Let me know if you need further adjustments!
AutoSprint:
GUI Styling:
Smooth Integration:
Let me know if you need further adjustments!
Animation Handling:
loadSprintAnimation() to load and manage the sprint animation.Debounce Logic:
AutoSprint Reliability:
toggleSprint() is called correctly.Animation Path:
RS.Animations.Player.Main.Sprint with the actual path to your sprint animation in ReplicatedStorage.Let me know if it works as expected now!
Sprint Animation Stopping:
isWPressed to track whether "W" is being held down.AutoSprint Reliability:
toggleSprint() when AutoSprint is enabled.Force Stop Sprinting:
forceStop parameter to toggleSprint() to ensure sprinting stops immediately when "W" is released.Debounce Logic:
Animation Path:
RS.Animations.Player.Main.Sprint with the actual path to your sprint animation in ReplicatedStorage.This should resolve all issues and ensure the sprint animation and AutoSprint work as expected!
Save/Load System:
Topbar GUI:
Persistent Settings:
Animation and Sprint Logic:
Replace RS.Animations.Player.Main.Sprint with the actual path to your sprint animation in ReplicatedStorage. Let me know if you need further adjustments!