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

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

Asked by 6 years ago
Edited 6 years ago

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?

0
Just change WalkSpeed.Value into WalkSpeed? User#20279 0 — 6y
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 Skyraider5 -21 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Nevermind I figured it out

Ad

Answer this question