Hello, my code doesn't execute I think I forgot something here with filtering enabled I think. I'm very unsure about the problem so thats why I can't solve it myself..
Anyone else who does?
local ContextActionService = game:GetService("ContextActionService")
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
-- Add a debounce variable
local debounce = false
local function pressedXHandler()
if debounce then return end
debounce = true
local hitCharacter = mouse.Target.Parent
local hitHumanoid = hitCharacter:FindFirstChildWhichIsA("Humanoid")
if hitHumanoid then
hitHumanoid:TakeDamage(25)
hitCharacter.Humanoid.Sit = true
local Push = Instance.new("BodyVelocity", hitCharacter.Torso)
Push.Velocity = hitCharacter.Torso.CFrame.lookVector * -63
Push.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
local Distance = Instance.new("BodyPosition", hitCharacter.Torso)
Distance.MaxForce = Vector3.new(0, 0, 2)
Distance.Position = Vector3.new(0, hitCharacter.CFrame.p.Y + 15, 0)
Push:Destroy()
Distance:Destroy()
wait(5)
hitCharacter.Humanoid.Sit = false
end
wait(20) -- This is the cooldown time
debounce = false
end
ContextActionService:BindAction("nameOfAction", pressedXHandler, false, Enum.KeyCode.X)
Thanks tho

3 comments
What do you mean your code "doesn't execute", does it not work at all? Does it stop working at a specific line. This is general debugging and should be included in your question.
Not going to be able to damage other players or move them via a localscript, will need to do via remote event
Ohh thats the problem