Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is there any code that needs to be added to this script?

I am trying to get a sprint key to work for console players, I thought it would be as simple as reusing the other one and changing the LeftShift to Thumbstick# But I cant get it to work, the script doesnt work and i tried looking up what the buttons are which for controllers but theres nothing showing me which buttons are which and I cant find a any script errors, any help would be nice! Thanks!

game:GetService("UserInputService").InputBegan:connect(function(input,gameprocesed)
 if input.KeyCode == Enum.KeyCode.Thumbstick1 then
  for i = 1,16 do
   wait()
   game.Workspace.Camera.FieldOfView = game.Workspace.Camera.FieldOfView + 1.2
   game.Players.LocalPlayer.Character:WaitForChild("Humanoid").WalkSpeed = game.Players.LocalPlayer.Character:WaitForChild("Humanoid").WalkSpeed + .50
  end
 end
end)

game:GetService("UserInputService").InputEnded:connect(function(input,gameprocesed)
 if input.KeyCode == Enum.KeyCode.Thumbstick1 then
  for i = 1,16 do
   wait()
   game.Workspace.Camera.FieldOfView = game.Workspace.Camera.FieldOfView - 1.2
   game.Players.LocalPlayer.Character:WaitForChild("Humanoid").WalkSpeed = game.Players.LocalPlayer.Character:WaitForChild("Humanoid").WalkSpeed - .50
  end
 end
end)

game.Players.LocalPlayer.Character:WaitForChild("Humanoid").Died:connect(function()
 game.Workspace.Camera.FieldOfView = 70
 game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16
 script.Disabled = true
end)

1 comment

0

connect is deprecated use Connect

1 answer

✓ Accepted answer

I just figured this out myself but Roblox has changed Enum.KeyCode.Thumbstick1 to Enum.KeyCode.ButtonL3. So just replace Thumbstick1 with ButtonL3 and it should work.

1 comment

0

OMG! Thanks so much it worked, good job!

This discussion is preserved as it was. New answers, comments, and votes are closed.