Buzzy

Register

Roblox Studio Tutorials - October 6, 2021

How to Sprint by Pressing a Key

1

Buzzy Beth

@buzzygamesbeth

Download – Sprint Scripts (DetectorSprint & WalkSpeed)

How To – Sprint by Pressing a Key on Roblox Studio

What’s up everyone welcome to buzzygames, my name is BuzzyGamesBeth and today I’ll be teaching you how to sprint by pressing a key!

  • So you’re going to go to starter player scripts and add a localscript. We’re going to define our variables here.
  • Next up we’re going to create a function where if any time a key code is pressed then it’s going to let the server know when to turn the sprint on or off. So i’m going to set the key code to shift, but you can change this to anything you want.
  • It’s going to be left shift for me and then of course create another function where anytime if I let go of the left shift button, then the server knows when to turn the sprints off.
  • Okay so in server script service we’ll be adding a script. So this script is going to tell us the speed of our sprint and first thing you want to do is go ahead and define our variables.
  • We’re going to create a function so that anytime the server realizes that we’re pressing the shift button then it’s going to execute the walk speed.
  • So the walk speed value we can change it to anything we would like. The default walk speed is 16 and I want torun as fast as I can -so i’m going to change that to 60.
  • So go ahead and click play and ah okay so it’s not working let me go ahead and hop back on to my script and the output set that walk speed. I forgot to capitalize the s in WalkSpeed so make sure that you capitalize that, capital W and walk capital S in Speed. Then that should be it!
  • I’m gonna go ahead and hold the left shift button you see how fast I can go! As fast as sonic the hedgehog. Alrighty guys so good job on creating your sprint key!