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

How can i keep the position of character inside a part?

i am going and attack where you throw a scythe and the character that touches the scythe follows it to an end position

https://i.imgur.com/VXw2Jlf.mp4

I am currently using

spawn(function()
local back = Vector3.new(0,0,-3)
local up = Vector3.new(0,-3,0)
local bv = Instance.new("BodyVelocity", character:FindFirstChild("HumanoidRootPart"))
bv.Name = "Knockback"
bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
bv.Velocity = hrp.CFrame.LookVector * 25 + back + up
game.Debris:AddItem(bv,.1) 
end)

2 comments

0

can you show the full script?

0

you can just loop a tp on the character to the part

1 answer

I suggest using AlignPosition instead of BodyVelocity. Even though BodyVelocity is deprecated and was replaced with AlignPosition, AlignPosition is more like a BodyPosition – which would also fit better for this job than a BodyVelocity.

local ap = Instance.new("AlignPosition", character:FindFirstChild("HumanoidRootPart"))

local attach0 = Instance.new("Attachment", character:FindFirstChild("HumanoidRootPart"))
local attach1 = Instance.new("Attachment", your_scythe)
ap.Attachment0 = attach0
ap.Attachment1 = attach1

ap.Name = "Knockback"
ap.MaxForce = math.huge

game.Debris:AddItem(ap, .1)
game.Debris:AddItem(attach0, .1)
game.Debris:AddItem(attach1, .1) 

1 comment

0

You're wrong. BodyVelocity was replaced with LinearVelocity.

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