Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 6 years ago

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)
0
connect is deprecated use Connect User#19524 175 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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.

0
OMG! Thanks so much it worked, good job! stonez12345678910 4 — 6y
Ad

Answer this question