Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why is this knockback script using velocity not working?

local Velocity = game.Players.LocalPlayer.Character.Torso.CFrame.lookVector
Velocity.Y = 10 + Velocity.Y
h.Parent.Torso.Velocity = Velocity *50

wait(.5)

This script makes a part fly backward relative to the player. It used to work until i tried to increase the why so it would go diagonally up. It script output says Y is not a valid property, but it should be.

Please help me!

1 answer

✓ Accepted answer

You cannot directly assign to any of the axis..

local p = game.Players.LocalPlayer;--player
local c = p.Character or p.CharacterAdded:Wait() --character
local root = c:WaitForChild("HumanoidRootPart"); --rootpart
local Velocity = root.CFrame.lookVector --root's velocity

wait(5);

root.Velocity = (Velocity*-100) + Vector3.new(0,100,0)

This discussion is preserved as it was. New answers, comments, and votes are closed.