generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Sprint key down problem

Previous Thread :: Next Thread 
cdw100100 is not online. cdw100100
Joined: 06 Feb 2012
Total Posts: 23
12 Aug 2013 02:57 AM
It works in solo ad tools >test>start server and tools.test.start player
but it didnt work when i played the game why?
I tis in a normal script

local Player = script.Parent.Parent.Parent.Parent.Parent.Parent
local Energy = script.Parent
local mouse = Player:GetMouse()
local Sprint = false

function onKeyDown(key)
key = key:lower()
if key == "z" then
Sprint = true
Run()
Walk()
end
end

function Run()
Player.Character.Humanoid.WalkSpeed = 25
while Sprint == true and Energy.Value > 0 do
wait(0.1)
Energy.Value = Energy.Value - 1
end
end

function Walk()
while Sprint == true and Energy.Value == 0 do
wait()
Player.Character.Humanoid.WalkSpeed = 16
end
end

function onKeyUp(key)
key = key:lower()
if key == "z" then
Sprint = false
Player.Character.Humanoid.WalkSpeed = 16
end
end

mouse.KeyUp:connect(onKeyUp)
mouse.KeyDown:connect(onKeyDown)
Report Abuse
Maileh is not online. Maileh
Joined: 14 Jun 2011
Total Posts: 1067
12 Aug 2013 03:05 AM
:GetMouse()
that gotta be a in localscript
Report Abuse
cdw100100 is not online. cdw100100
Joined: 06 Feb 2012
Total Posts: 23
12 Aug 2013 03:08 AM
Thank you I was testing and i tryed local scripts and they worked. But thank you anyways.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image