Tool.Equipped:connect(function(TempMouse)
Equipped = true
if Module.AmmoPerMag ~= math.huge then GUI.Frame.Visible = true end
GUI.Parent = Player.PlayerGui
UpdateGUI()
Handle.EquippedSound:Play()
if Module.WalkSpeedRedutionEnabled then
Humanoid.WalkSpeed = Humanoid.WalkSpeed - Module.WalkSpeedRedution
else
Humanoid.WalkSpeed = Humanoid.WalkSpeed
end
CrosshairModule:setcrosssettings(Module.CrossSize, Module.CrossSpeed, Module.CrossDamper)
UserInputService.MouseIconEnabled = false
if EquippedAnim then EquippedAnim:Play(nil,nil,Module.EquippedAnimationSpeed) end
if IdleAnim then IdleAnim:Play(nil,nil,Module.IdleAnimationSpeed) end
TempMouse.KeyDown:connect(function(Key)
----------------------IMPORTANT HERE--------------------------------
if string.lower(Key) == "r" then
Reload()
if string.lower(Key) == Enum.KeyCode.ButtonX then
Reload()
-------------------------------------------------
✓ ANSWER ACCEPTED
How do i make the X button work for controller?
1 answer
✓ Accepted answer
I believe you're looking for Gamepad-Input
Example Code:
local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.Gamepad1 then
if input.KeyCode == Enum.KeyCode.ButtonX then
-- Button x pressed
end
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Thanks so much, made everything much easier in my life. Honestly coding Xbox sucks. If you have the time, is there a way or a source I can read to active controller vibrate if something happens?