Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is there a way I can fix the knockback of something and make it look better?

Asked by 2 years ago

Hi, I've been making a swordfight game and the ability for one of the swords is to hit people and knock them back. The knockback works occasionally, but could use some improvement. What I mean by occasionally is that whenever the player is on the ground, the knockback never works, but it does in the air. Overall though, how can I make the knockback look and do better? I just would like it to feel more like you're being knocked back instead of the player just flying back with no effects. Help and ideas would be appreciated!

Here is the script:

 bat.Handle.hitbox.Touched:Connect(function(hit)
                if hit.Parent:FindFirstChild("Humanoid") then
                        if hit.Parent.Name ~= player.Name then
                                if debounce == false then
                                        debounce = true
                                        local force = Instance.new("BodyForce",hit.Parent.HumanoidRootPart)
                                        force.Force = char.HumanoidRootPart.CFrame.lookVector * 7000

                                        hit.Parent.Humanoid:TakeDamage(15)

                                        game.Debris:AddItem(force,.5)
                                    end
                            end
                end
        end)

Answer this question