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------------------------------------
Deepwoken and Ghoul://re Type GUI Style Settings Button
Below is a modified version of your script that includes a settings button in the left of the player's screen. When clicked, it gives the option to enable autosprint.
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 improved GUI styling and autosprint functionality:
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 with the sprint animation not playing and the character walking instead of sprinting when autosprint is enabled could be due to several reasons. Here are a few potential solutions:
Animation Track: Make sure that the SprintTrack variable is correctly set to the sprint animation track. You can do this by printing the value of SprintTrack before playing the animation.
Animation Priority: Ensure that the sprint animation has a high enough priority to play over other animations. You can set the priority of the animation track using the Priority property.
Character Attributes: Verify that the character's attributes, such as Stunned, IsRagdoll, IsBlocking, and Attacking, are not set to values that prevent sprinting.
WalkSpeed and RunSpeed: Check that the walkSpeed and runSpeed variables are set to reasonable values. If the runSpeed is too low, it may not feel like the character is sprinting.
Debounce: The debounce variable is used to prevent the sprint animation from playing too quickly. However, if this variable is not reset correctly, it could prevent the animation from playing.
Here's an updated version of the script with some additional debugging statements and modifications to address these issues:
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 an updated version of the script that stops the sprint animation when the player stops holding W and ensures that autosprint works every time a player presses W:
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
Here's an updated version of the script that saves the autosprint setting and improves the GUI:
-- ...
local DataStoreService = game:GetService("DataStoreService")
local dataStore = DataStoreService:GetDataStore("AutosprintData")
-- ...
local function saveAutosprintSetting()
local playerId = plr.UserId
dataStore:SetAsync(playerId, autoSprintEnabled)
end
local function loadAutosprintSetting()
local playerId = plr.UserId
local autosprintSetting = dataStore:GetAsync(playerId)
if autosprintSetting ~= nil then
autoSprintEnabled = autosprintSetting
if autoSprintEnabled then
autoSprintToggle.Text = "Autosprint: Enabled"
else
autoSprintToggle.Text = "Autosprint: Disabled"
end
end
end
-- ...
game.Players.PlayerRemoving:Connect(function(player)
if player == plr then
saveAutosprintSetting()
end
end)
plr.CharacterAdded:Connect(function()
loadAutosprintSetting()
end)
-- ...
-- Create topbar GUI
local topbar = Instance.new("Frame")
topbar.Size = UDim2.new(1, 0, 0, 40)
topbar.Position = UDim2.new(0, 0, 0, 0)
topbar.BackgroundColor3 = Color3.new(0.2, 0.2, 0.2)
topbar.BorderSizePixel = 0
topbar.Parent = plr.PlayerGui
local settingsButton = Instance.new("ImageButton")
settingsButton.Size = UDim2.new(0, 30, 0, 30)
settingsButton.Position = UDim2.new(1, -40, 0, 5)
settingsButton.Image = "rbxassetid://11462446741"
settingsButton.Parent = topbar
local settingsMenu = Instance.new("Frame")
settingsMenu.Size = UDim2.new(0, 200, 0, 150)
settingsMenu.Position = UDim2.new(1, -220, 0, 45)
settingsMenu.BackgroundColor3 = Color3.new(0.2, 0.2, 0.2)
settingsMenu.BorderSizePixel = 0
settingsMenu.Visible = false
settingsMenu.Parent = plr.PlayerGui
local autoSprintToggle = Instance.new("TextButton")
autoSprintToggle.Size = UDim2.new(0, 180, 0, 30)
autoSprintToggle.Position = UDim2.new(0, 10, 0, 10)
autoSprintToggle.Text = "Autosprint: Disabled"
autoSprintToggle.TextColor3 = Color3.new(1, 1, 1)
autoSprintToggle.BackgroundColor3 = Color3.new(0.3, 0.3, 0.3)
autoSprintToggle.BackgroundTransparency = 0.5
autoSprintToggle.BorderSizePixel = 0
autoSprintToggle.Parent = settingsMenu
settingsButton.MouseButton1Click:Connect(function()
settingsMenu.Visible = not settingsMenu.Visible
end)
autoSprintToggle.MouseButton1Click:Connect(function()
autoSprintEnabled = not autoSprintEnabled
if autoSprintEnabled then
autoSprintToggle.Text = "Autosprint: Enabled"
else
autoSprintToggle.Text = "Autosprint: Disabled"
end
saveAutosprintSetting()
end)
loadAutosprintSetting()
--||Services||--
local RS = game:GetService("ReplicatedStorage")
local uis = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
--||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
local autoSprintEnabled = false
--||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
--||Animations||--
local SprintTrack = nil
local SprintAnim = nil
-- Create settings button
local settingsButton = Instance.new("ImageButton")
settingsButton.Image = "rbxassetid://11462446741" -- Replace with your desired icon
settingsButton.Size = UDim2.new(0, 30, 0, 30)
settingsButton.Position = UDim2.new(0, 10, 0, 10)
settingsButton.Parent = plr.PlayerGui
-- Create settings menu
local settingsMenu = Instance.new("Frame")
settingsMenu.Size = UDim2.new(0, 200, 0, 100)
settingsMenu.Position = UDim2.new(0, 50, 0, 50)
settingsMenu.BackgroundTransparency = 0.5
settingsMenu.BackgroundColor3 = Color3.new(1, 1, 1)
settingsMenu.Visible = false
settingsMenu.Parent = plr.PlayerGui
-- Create autosprint toggle
local autoSprintToggle = Instance.new("TextButton")
autoSprintToggle.Size = UDim2.new(0, 150, 0, 30)
autoSprintToggle.Position = UDim2.new(0, 25, 0, 25)
autoSprintToggle.Text = "Autosprint: Disabled"
autoSprintToggle.Parent = settingsMenu
-- Function to toggle autosprint
local function toggleAutosprint()
autoSprintEnabled = not autoSprintEnabled
if autoSprintEnabled then
autoSprintToggle.Text = "Autosprint: Enabled"
else
autoSprintToggle.Text = "Autosprint: Disabled"
end
end
-- Connect autosprint toggle
autoSprintToggle.MouseButton1Click:Connect(toggleAutosprint)
-- Function to shift to sprint
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 to handle key press
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
if autoSprintEnabled then
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)
else
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
end
-- Function to handle key release
function onKeyRelease(inputObject, isTyping)
if isTyping then return end
if inputObject.KeyCode == Enum.KeyCode.W and isSprinting then
shiftToSprint()
end
end
-- Connect input events
uis.InputBegan:Connect(onKeyPress)
uis.InputEnded:Connect(onKeyRelease)
-- Connect settings button
settingsButton.MouseButton1Click:Connect(function()
settingsMenu.Visible = not settingsMenu.Visible
end)
-- Connect character events
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------------------------------------
This script creates a settings button in the top left corner of the screen. When clicked, it toggles a settings menu that includes an autosprint toggle. If autosprint is enabled, the player can sprint by holding down the W key. If autosprint is disabled, the player must double-tap the W key to sprint.
--||Services||--
local RS = game:GetService("ReplicatedStorage")
local uis = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
--||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 autoSprintEnabled = false
--||Settings||--
local runSpeed = 28
local walkSpeed = 18
--||Animations||--
local SprintTrack = nil
local SprintAnim = nil
-- Create settings button
local settingsButton = Instance.new("ImageButton")
settingsButton.Image = "rbxassetid://11462446741" -- Replace with your desired icon
settingsButton.Size = UDim2.new(0, 40, 0, 40)
settingsButton.Position = UDim2.new(0, 10, 0, 10)
settingsButton.BackgroundTransparency = 1
settingsButton.Parent = plr.PlayerGui
-- Create settings menu
local settingsMenu = Instance.new("Frame")
settingsMenu.Size = UDim2.new(0, 200, 0, 150)
settingsMenu.Position = UDim2.new(0, 60, 0, 60)
settingsMenu.BackgroundColor3 = Color3.new(0.2, 0.2, 0.2)
settingsMenu.BackgroundTransparency = 0.5
settingsMenu.BorderSizePixel = 0
settingsMenu.Visible = false
settingsMenu.Parent = plr.PlayerGui
-- Create autosprint toggle
local autoSprintToggle = Instance.new("TextButton")
autoSprintToggle.Size = UDim2.new(0, 180, 0, 30)
autoSprintToggle.Position = UDim2.new(0, 10, 0, 10)
autoSprintToggle.Text = "Autosprint: Disabled"
autoSprintToggle.TextColor3 = Color3.new(1, 1, 1)
autoSprintToggle.BackgroundColor3 = Color3.new(0.3, 0.3, 0.3)
autoSprintToggle.BackgroundTransparency = 0.5
autoSprintToggle.BorderSizePixel = 0
autoSprintToggle.Parent = settingsMenu
-- Create autosprint toggle text
local autoSprintText = Instance.new("TextLabel")
autoSprintText.Size = UDim2.new(0, 180, 0, 30)
autoSprintText.Position = UDim2.new(0, 10, 0, 50)
autoSprintText.Text = "Enable autosprint to sprint by holding W"
autoSprintText.TextColor3 = Color3.new(0.8, 0.8, 0.8)
autoSprintText.BackgroundTransparency = 1
autoSprintText.Parent = settingsMenu
-- Function to toggle autosprint
local function toggleAutosprint()
autoSprintEnabled = not autoSprintEnabled
if autoSprintEnabled then
autoSprintToggle.Text = "Autosprint: Enabled"
else
autoSprintToggle.Text = "Autosprint: Disabled"
end
end
-- Connect autosprint toggle
autoSprintToggle.MouseButton1Click:Connect(toggleAutosprint)
-- Function to shift to sprint
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 to handle key press
local wPressed = false
uis.InputBegan:Connect(function(inputObject, isTyping)
if isTyping then return end
if inputObject.KeyCode == Enum.KeyCode.W then
wPressed = true
if autoSprintEnabled then
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
end
end)
uis.InputEnded:Connect(function(inputObject, isTyping)
if isTyping then return end
if inputObject.KeyCode == Enum.KeyCode.W then
wPressed = false
if isSprinting and not autoSprintEnabled then
shiftToSprint()
end
end
end)
RunService.RenderStepped:Connect(function()
if wPressed and autoSprintEnabled and not isSprinting and not debounce and not char:GetAttribute("Stunned") and not char:GetAttribute("IsRagdoll") and not char:GetAttribute("IsBlocking") and not char:GetAttribute("Attacking") then
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)
elseif not wPressed and isSprinting and autoSprintEnabled then
shiftToSprint()
end
end)
-- Connect settings button
settingsButton.MouseButton1Click:Connect(function()
settingsMenu.Visible = not settingsMenu.Visible
end)
-- Connect character events
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------------------------------------
This script creates a settings button in the top left corner of the screen. When clicked, it toggles a settings menu that includes an autosprint toggle. If autosprint is enabled, the player can sprint by holding down the W key. If autosprint is disabled, the player must double-tap the W key to sprint. The GUI has been styled to resemble Deepwoken and Ghoul://re.
-- ...
-- Function to shift to sprint
function shiftToSprint(SprintTrack)
print("Shift to sprint")
if isSprinting and not debounce then
debounce = true
if not char:GetAttribute("Attacking") and not char:GetAttribute("Stunned") then hum.WalkSpeed = walkSpeed end
TS:Create(camera, TweenInfo.new(.5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {FieldOfView = 70}):Play()
isSprinting = false
if SprintAnim then
SprintAnim:Stop()
print("Stopped sprint animation")
end
char:SetAttribute("Sprinting", false)
task.wait(.5)
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()
isSprinting = true
SprintAnim = hum.Animator:LoadAnimation(SprintTrack)
SprintAnim.Priority = Enum.AnimationPriority.High
SprintAnim:Play()
print("Played sprint animation")
end
end
-- ...
RunService.RenderStepped:Connect(function()
if wPressed and autoSprintEnabled and not isSprinting and not debounce and not char:GetAttribute("Stunned") and not char:GetAttribute("IsRagdoll") and not char:GetAttribute("IsBlocking") and not char:GetAttribute("Attacking") then
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)
elseif not wPressed and isSprinting and autoSprintEnabled then
shiftToSprint()
end
end)
This updated script includes additional print statements to help with debugging and sets the priority of the sprint animation to High. If you're still experiencing issues, you may want to try adjusting the walkSpeed and runSpeed variables or modifying the debounce logic.
-- ...
local wPressed = false
local sprinting = false
-- ...
-- Function to handle key press
uis.InputBegan:Connect(function(inputObject, isTyping)
if isTyping then return end
if inputObject.KeyCode == Enum.KeyCode.W then
wPressed = true
if not sprinting and not debounce and not char:GetAttribute("Stunned") and not char:GetAttribute("IsRagdoll") and not char:GetAttribute("IsBlocking") and not char:GetAttribute("Attacking") then
if autoSprintEnabled then
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
end
end
end)
-- Function to handle key release
uis.InputEnded:Connect(function(inputObject, isTyping)
if isTyping then return end
if inputObject.KeyCode == Enum.KeyCode.W then
wPressed = false
if sprinting and autoSprintEnabled then
shiftToSprint()
end
end
end)
-- ...
RunService.RenderStepped:Connect(function()
if wPressed and autoSprintEnabled and not sprinting and not debounce and not char:GetAttribute("Stunned") and not char:GetAttribute("IsRagdoll") and not char:GetAttribute("IsBlocking") and not char:GetAttribute("Attacking") then
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)
sprinting = true
elseif not wPressed and sprinting and autoSprintEnabled then
shiftToSprint()
sprinting = false
end
end)
-- Function to shift to sprint
function shiftToSprint(SprintTrack)
if sprinting and not debounce then
debounce = true
if not char:GetAttribute("Attacking") and not char:GetAttribute("Stunned") then hum.WalkSpeed = walkSpeed end
TS:Create(camera, TweenInfo.new(.5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {FieldOfView = 70}):Play()
sprinting = false
if SprintAnim then
SprintAnim:Stop()
end
char:SetAttribute("Sprinting", false)
task.wait(.5)
debounce = false
elseif not sprinting 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()
sprinting = true
SprintAnim = hum.Animator:LoadAnimation(SprintTrack)
SprintAnim.Priority = Enum.AnimationPriority.High
SprintAnim:Play()
end
end
This updated script adds a sprinting variable to track whether the player is currently sprinting, and modifies the shiftToSprint function to stop the sprint animation when the player stops holding W. The RenderStepped event is also modified to ensure that autosprint works every time a player presses W.
This updated script adds a DataStoreService to save and load the autosprint setting, and improves the GUI to resemble the topbar GUI of Deepwoken or Strongest Battlegrounds. The autosprint setting is saved every time the player leaves or respawns, and loaded when the player rejoins or respawns.