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
 

Re: More efficient sprint script?

Previous Thread :: Next Thread 
iSpecializinq is not online. iSpecializinq
Joined: 31 May 2015
Total Posts: 2182
24 Jun 2015 06:27 PM
So I based this off WishNite's but I made the camera 'tweening' I think its called smoother. Is there a more efficient way to do this?
Report Abuse
Darkmist101 is not online. Darkmist101
Joined: 30 Jul 2010
Total Posts: 6208
24 Jun 2015 06:29 PM
Try using Camera:Interpolate
Report Abuse
iSpecializinq is not online. iSpecializinq
Joined: 31 May 2015
Total Posts: 2182
24 Jun 2015 06:30 PM
Oh wait I forgot the code lol

good thing you didn't notice

anyways, here ya go
any more efficient way?

local Players = game:GetService'Players';

repeat wait() until Players.LocalPlayer and Players.LocalPlayer.Character

local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()

local RenderStepped = game:GetService("RunService").RenderStepped

local UserInputService = game:GetService'UserInputService';
local CurrentCamera = workspace.CurrentCamera

if game:GetService("MarketplaceService"):PlayerOwnsAsset(Player,262137039) then
local function Sprint()
Character.Humanoid.WalkSpeed = Character.Humanoid.WalkSpeed*2;
for i = 1,35 do
CurrentCamera.FieldOfView = CurrentCamera.FieldOfView + 1;
RenderStepped:wait()
end
end
local function Unsprint()
Character.Humanoid.WalkSpeed = Character.Humanoid.WalkSpeed*.5;
for i = 1,35 do
CurrentCamera.FieldOfView = CurrentCamera.FieldOfView - 1;
RenderStepped:wait()
end
end
UserInputService.InputBegan:connect(function(Input,gameProcessedEvent)
if Input.UserInputType == Enum.UserInputType.Keyboard and not gameProcessedEvent then
if Input.KeyCode == Enum.KeyCode.LeftShift then
Sprint()
end
end
end)
UserInputService.InputEnded:connect(function(Input,gameProcessedEvent)
if Input.UserInputType == Enum.UserInputType.Keyboard and not gameProcessedEvent then
if Input.KeyCode == Enum.KeyCode.LeftShift then
Unsprint()
end
end
end)
end
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