How would i be able to bind a controller button to this too?

This is only a small portion of the code, but when i press X it doesnt do anything but F works

RunService.RenderStepped:Connect(function()
	local Player = game.Players.LocalPlayer
	local Char = Player.Character
	local Hum = Char:FindFirstChild("Humanoid")

	if UIS:IsKeyDown(Enum.KeyCode.F or Enum.KeyCode.ButtonX) then
			if Blocking == false then
				Blocking = true
			Remote:FireServer("Block",true)
			end	
	else
		if Blocking == true then
			Blocking = false
			Remote:FireServer("Block",false)
		end
	end
end)	

I’m still a beginner at scripting and I’ve tried looking how to do this but I don’t understand any of it. All help appreciated.

you’d have to adjust your if statement to check IsKeyDown for F and X separately, so it’d be:
if UIS:IsKeyDown(Enum.KeyCode.F) or UIS:IsKeyDown(Enum.KeyCode.ButtonX) then

for some reason this just doesnt seem to work…

does it work with F if you take out the or UIS:IsKeyDown(Enum.KeyCode.ButtonX)?

it works with f but X doesnt work

Im not too familiar with controllers, so I’m thinking that maybe ButtonX is the wrong enum

try adding this to your script to see what pribts when you press the controller button

UIS.InputBegan:Connect(function(input, caughtByGui)
   print(input.KeyCode)
end)