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

Knock back works in studio not in game? error fixing

Asked by 6 years ago
character:FindFirstChild("Left Arm").Touched:connect(function(hit)
            if debounce == false then
                if hit.Parent:FindFirstChild("Humanoid") and debounce == false and punching == true then
                    player.data.cash.Value = player.data.cash.Value + 10
                    debounce = true
                    punching = false
                    hit.Parent.Humanoid:TakeDamage(damage)
                    soundeffects.PunchHit:Play()
                    if player.data.dmg.Value >= 200 then
                    local yesorno = math.random(1,3)
                    if yesorno == 1 then
    local h = hit.Parent.Humanoid
if h then
        wait()
        h.Jump = true
        h.Parent.Torso.Velocity = (CFrame.new(character.Torso.Position, h.Parent.Torso.Position).lookVector * 100) + Vector3.new(0, 30, 0)
        h.Parent.Torso.RotVelocity = Vector3.new(math.random(-100, 100), math.random(-100, 100), math.random(-100, 100))

                end
                    end
                end
                end
                end
        end)

in studio it knocks back the npc i have for testing in game when it doesnt knock people back. i dont know why and i would like some help.

0
Not answering without error logs. Griffi0n 315 — 6y
0
Can you edit or tell us what are the errors? HeyItzDanniee 252 — 6y

Answer this question