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 » Scripters
Home Search
 

Need some fixes to this that I couldn't solve

Previous Thread :: Next Thread 
Korniak is not online. Korniak
Joined: 09 Aug 2013
Total Posts: 3538
29 Dec 2016 02:26 PM
This is basically a shift to sprint script, but the problem is, with two keys being pressed down other than LeftShift, the FOV can be glitched. I also would like a cooldown and a limit on sprinting, but I have no clue on where to put this. Can anyone help?






Code:
uis.InputBegan:connect(function(key)
if key.KeyCode == Enum.KeyCode.LeftShift then
running = true
local conn = uis.InputEnded:connect(function(key)
if key.KeyCode == Enum.KeyCode.LeftShift then
running = false
end
end)
for i = 0,9 do
workspace.CurrentCamera.FieldOfView = workspace.CurrentCamera.FieldOfView + 1
wait()
end
char.Humanoid.WalkSpeed = 20
repeat wait() until running == false
conn:Disconnect()
char.Humanoid.WalkSpeed = 16
for i = 0,9 do
workspace.CurrentCamera.FieldOfView = workspace.CurrentCamera.FieldOfView + 1
wait()
end
end
end)


~Korniak
Report Abuse
Korniak is not online. Korniak
Joined: 09 Aug 2013
Total Posts: 3538
29 Dec 2016 02:47 PM
bump


~Korniak
Report Abuse
iYoshiFox is not online. iYoshiFox
Joined: 14 Apr 2012
Total Posts: 1058
29 Dec 2016 02:54 PM

I edited your code, try it out.


uis.InputBegan:connect(function(key)
if key.KeyCode == Enum.KeyCode.LeftShift then
running = true
local conn = uis.InputEnded:connect(function(key)
if key.KeyCode == Enum.KeyCode.LeftShift then
running = false
end
end)
for i = 0,9 do
if running then
workspace.CurrentCamera.FieldOfView = workspace.CurrentCamera.FieldOfView + 1
wait()
end
end
char.Humanoid.WalkSpeed = 20
repeat wait() until running == false
conn:Disconnect()
char.Humanoid.WalkSpeed = 16
for i = 0,9 do
if not running then
workspace.CurrentCamera.FieldOfView = workspace.CurrentCamera.FieldOfView + 1
wait()
end
end
end
end)
Report Abuse
Korniak is not online. Korniak
Joined: 09 Aug 2013
Total Posts: 3538
29 Dec 2016 02:58 PM
Fixed the FOV bug because of a small mistake.


All that's left now is the cooldown and limit on sprinting.


~Korniak
Report Abuse
Korniak is not online. Korniak
Joined: 09 Aug 2013
Total Posts: 3538
29 Dec 2016 03:16 PM
bump2


~Korniak
Report Abuse
iYoshiFox is not online. iYoshiFox
Joined: 14 Apr 2012
Total Posts: 1058
29 Dec 2016 03:20 PM
local running = false local userInputService = game:GetService("UserInputService") userInputService.InputBegan:connect(function(key) if key.KeyCode == Enum.KeyCode.LeftShift then running = true end end) userInputService.InputEnded:connect(function(key) if key.KeyCode == Enum.KeyCode.LeftShift then running = false end end) spawn(function() local lastState = running while wait() do if ######### ## running then if running then char.Humanoid.WalkSpeed = 20 for i = 1, 10 do if not running break end cam.FieldOfView = cam.FieldOfView + 1 end else char.Humanoid.WalkSpeed = 16 for i = 1, 10 do if not running break end cam.FieldOfView = cam.FieldOfView - 1 end end end end end)
Report Abuse
iYoshiFox is not online. iYoshiFox
Joined: 14 Apr 2012
Total Posts: 1058
29 Dec 2016 03:23 PM
local running = false local userInputService = game:GetService("UserInputService") userInputService.InputBegan:connect(function(key) if key.KeyCode == Enum.KeyCode.LeftShift then running = true end end) userInputService.InputEnded:connect(function(key) if key.KeyCode == Enum.KeyCode.LeftShift then running = false end end) spawn(function() local lastState = running while wait() do if ######### ## running then lastState = running if running then char.Humanoid.WalkSpeed = 20 for i = 1, 10 do if not running break end cam.FieldOfView = cam.FieldOfView + 1 end else char.Humanoid.WalkSpeed = 16 for i = 1, 10 do if running break end cam.FieldOfView = cam.FieldOfView - 1 end end end end end)
Report Abuse
iYoshiFox is not online. iYoshiFox
Joined: 14 Apr 2012
Total Posts: 1058
29 Dec 2016 03:24 PM
pastebin c0m/b0YBQprP
Report Abuse
Korniak is not online. Korniak
Joined: 09 Aug 2013
Total Posts: 3538
29 Dec 2016 03:56 PM
bump2


~Korniak
Report Abuse
Korniak is not online. Korniak
Joined: 09 Aug 2013
Total Posts: 3538
29 Dec 2016 05:22 PM
Still need to mend in a way for a cooldown and a limit on scripting


Thanks if anyone can help.


~Korniak
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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