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

Why is this knockback script using velocity not working?

Asked by 6 years ago
Edited 6 years ago
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

Log in to vote
0
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
6 years ago

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)
Ad

Answer this question