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

--||Animations||--
local SprintTrack = nil
local SprintAnim = nil
------------------------------------------------------------------------------------------------------------------




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------------------------------------