Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

[Mobile] Hold down button to sprint?

Asked by 4 years ago

So im trying to make a button that makes the player sprint for mobile.

Heres my code:

local player = game.Players.LocalPlayer
local char = player.Character
local mobile = game:GetService("ContextActionService")
function sprint()
    char.Humanoid.WalkSpeed = 35
    end
end

local EnableSprint = mobile:BindAction("MobileSprint",sprint,true,"")
mobile:SetPosition("MobileSprint",UDim2.new(0.72,-25,0.20,-25))

It doesnt work because the player doesnt go to its default speed of 16. Any help?

0
You didnt make it so that i resets to 16 lol DEVLogos 8 — 4y
0
Doesn't matter I changed the code User#29320 0 — 4y
0
wow dang i was actually building custom buttons oof greatneil80 2647 — 4y

Answer this question