So I’m using ContextActionService for my game in order to make my game mobile-friendly, however, what I’ve noticed is that when I use :BindAction() in order to run a function, it will run that function twice, when I press the key, and when I let go of the key, I only want the function running when the key is first pressed, but I don’t want to use UserInputService since I want to use all the perks ContextActionService gives, here’s my code:
--LocalScript
local function leftClickAction()
game.ReplicatedStorage.BasicAttackPlay:FireServer()
end
game.ContextActionService:BindActivate("leftClick",leftClickAction, true, Enum.UserInputType.MouseButton1)
--ServerScript
game.ReplicatedStorage.SideAttackPlay.OnServerEvent:Connect(function(player)
local dummy0 = game.Workspace[tostring(player)]
local animTrack0 = dummy0.Humanoid:LoadAnimation(game.ReplicatedStorage.SideAttackAnimation)
animTrack0:Play()
end)