Lua script Gamepad

hii guysss
i have a problem with lua i can’t activate the direction of the gamepad. i made a simple animation with anim graph i added speed idle and direction option. direction option use vector2 and i don’t understand where i am wrong to insert the script in the guides they don’t say it there are only guides on how to use W and S but they don’t speak for the gamepad i leave you with the lua script i am not understanding nothing :frowning: script >>>> : local PlayerController3=
{
Properties = { }
}

function PlayerController3:OnActivate()
self.forwardBusId = InputEventNotificationId(“move”)
self.forwardBus = InputEventNotificationBus.Connect(self, self.forwardBusId )
end

function PlayerController3:OnDeactivate()
– Don’t forget to disconnect your buses promptly when you
– no longer need them to avoid unwarranted behavior.
– The best place to do this is OnDeactivate()
self.forwardBus:Disconnect()
end

function PlayerController3:OnPressed(_,Value)
local currentBusId = InputEventNotificationBus.GetCurrentBusId()
if currentBusId == self.forwardBusId then
AnimGraphComponentRequestBus.Event.SetNamedParameterFloat(self.entityId, “speed”, 1.0)
end
end

function PlayerController3:OnHeld(_,Value)
local currentBusId = InputEventNotificationBus.GetCurrentBusId()
if currentBusId == self.forwardBusId then
AnimGraphComponentRequestBus.Event.SetNamedParameterFloat(self.entityId, “speed”, 1.0)
end
end

function PlayerController3:OnReleased(_,Value)
local currentBusId = InputEventNotificationBus.GetCurrentBusId()
if currentBusId == self.forwardBusId then
AnimGraphComponentRequestBus.Event.SetNamedParameterFloat(self.entityId, “speed”, -1.0)
end
end

local PlyareController3 =
{
Properties =
{
XCoordEventName = “direction”,
YCoordEventName = “direction”,
OutgoingGameplayEventName = “Vector2”,
DeadZoneLength = 0.2,
},
}

function PlayerController3:OnActivate()
self.vectorizedValue = Vector2(0,0)
self.active = false
self.outgoingId = GameplayNotificationId(self.entityId, self.Properties.OutgoingGameplayEventName, “Vector2”)
self.vectorizedHandlers = PlayerController3.ConnectMultiHandlers{
[GameplayNotificationId(self.entityId, self.Properties.XCoordEventName, “direction”)] = {
OnEventBegin = function(floatValue) self:UpdateX(floatValue) end,
OnEventUpdating = function(floatValue) self:UpdateX(floatValue) end,
OnEventEnd = function(floatValue) self:UpdateX(0) end,
},
[GameplayNotificationId(self.entityId, self.Properties.YCoordEventName, “direction”)] = {
OnEventBegin = function(floatValue) self:UpdateY(floatValue) end,
OnEventUpdating = function(floatValue) self:UpdateY(floatValue) end,
OnEventEnd = function(floatValue) self:UpdateY(0) end,
},
}
end
function PlayerController3:OnDeactivate()
self.PlayerController3:Disconnect()
self.deprecatedVectorizedHandlers:Disconnect()
end

function PlayerController3:SendGameplayEvent()
local shouldBeActive = self.vectorizedValue:GetLength() > self.Properties.DeadZoneLength
if shouldBeActive and not self.active then
GameplayNotificationBus.Event.OnEventBegin(self.outgoingId, self.vectorizedValue, “direction”)
elseif shouldBeActive and self.active then
GameplayNotificationBus.Event.OnEventUpdating(self.outgoingId, self.vectorizedValue, “direction”)
elseif not shouldBeActive and self.active then
GameplayNotificationBus.Event.OnEventEnd(self.outgoingId, self.vectorizedValue, “direction”)
end
self.active = shouldBeActive
– otherwise we were not active and shouldn’t be active so do nothing
end

– X coordinate handlers
function PlayerController3:UpdateX(floatValue)
self.vectorizedValue.x = floatValue
self:SendGameplayEvent()
end

– Y coordinate handlers
function PlayerController3:UpdateY(floatValue)
self.vectorizedValue.y = floatValue
self:SendGameplayEvent()
end

return PlayerController3