So I’m making this fighting game but there’s just one problem: this knockback/dmg script in ServerScriptService won’t work. Here’s the script:
local RmtEvent = game.ReplicatedStorage.Punch
local Dmg = game.ReplicatedStorage.Values.DmgValue.Value
local PunchSFX = game.SoundService.Punch
local BV = Instance.new("BodyVelocity")
local debounce = false
RmtEvent.OnServerEvent:Connect(function(Player, Character)
if not debounce then
debounce = true
if Character:FindFirstChild("Humanoid")then
Character.Humanoid:TakeDamage(Dmg)
PunchSFX:Play()
BV.Parent = Character.HumanoidRootPart
end
BV.MaxForce = Vector3.new(800000, 800000, 800000)
BV.Velocity = Character:FindFirstChild("HumanoidRootPart").CFrame.LookVector * -40
wait(1)
BV.MaxForce = Vector3.new(4000, 4000, 4000)
BV.Velocity = Vector3.new(0, 2, 0)
wait(0.7)
debounce = false
end
end)
So when I try this script, the enemy doesn’t fall back
Are there any mistakes? let me know!