I've made a script for xbox controls by just using keydown, but it does not work it gives me the error of: "Keydown is not a valid member of ControllerService", please help?
local player = game.Players.LocalPlayer repeat wait() until player.Character.Humanoid local humanoid = player.Character.Humanoid local mouse = player:GetMouse() local XboxButton = game:GetService("ControllerService") XboxButton.KeyDown:connect(function(key) if key == "x" then game.Players.LocalPlayer.Character:WaitForChild("Humanoid").Health = 0 end end)
KeyDown
event does not exist on the ControllerService
. You attempted an event similar to Mouse.KeyDown
, which the mouse event is deprecated and should not be used in new work. Use UserInputService
.--LocalScript local plr = game:GetService("Players").LocalPlayer local char = plr.Character or plr.CharacterAdded:Wait() local UIS = game:GetService"UserInputService" UIS.InputBegan:Connect(function(key) -- Use :Connect, :connect is deprecated if key.KeyCode == Enum.KeyCode.ButtonX then --Xbox button X code char:BreakJoints() end end)