Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do you make a script that allows players to sprint/run (Script already written, what is wrong)?

Hi, I have a working sprint script for computers, you press shift and your walk speed becomes 32 instead of 16 and all of that works perfectly, but now I am trying to make a button for MOBILE players that will make your speed 32 when pressed and 16 when pressed again etc etc. Anyway, I made the button successfully but when I press it (While testing it in Emulator mode of course) my walk speed doesn't change so the button is there but it doesn't do anything when pressed. Here is my current script:

local player = game.Players.LocalPlayer
local ContextActionService = game:GetService("ContextActionService")

function onButtonPress()
	player.Character.Humanoid.WalkSpeed = 32
end
ContextActionService:BindAction("Sprint", onButtonPress, true, "304")
ContextActionService:SetPosition("Sprint",UDim2.new(0.72,-25,0.20,-25))
ContextActionService:SetImage("Sprint", "http://www.roblox.com/asset/?id=343820594")

It is in a local script in the Starter Gui folder just like it is supposed to, and I turned experimental mode off like you're supposed to so I'm confused about what the problem is. Can anyone help me out?

2 comments

0

Just change WalkSpeed.Value into WalkSpeed?

0

Oh, sorry, I already did that I need to edit my script in the question, anyway it didn't work but thanks for trying to help

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.