#Knockback
1 messages · Page 1 of 1 (latest)
the easiest way would be to use bodyVelocity
body velocity flings
** You are now Level 1! **
not if u do it properly
local bv = Instance.new("BodyVelocity")
bv.MaxForce, bv.Velocity = Vector3.new(5e4,5e2,5e4),plr.Character.HumanoidRootPart.CFrame.lookVector * 10
bv.Parent = hit.Parent.HumanoidRootPart
game.Debris:AddItem(bv,0.16)
this worked fine for me
I used that before it was working weird
like you fly when you hit a wall
alright ima try but what are the numbers in the vector3.new? 5e4 5e2?
they are just very big numbers
ig
mines worked perfectly
scientific notation
bv.MaxForce = Vector3.new(50000, 500, 50000)
I use linear velocity now, it works perfectly for me
basically this
this is better
im just saying this the easiest way
body velocity is depreciated
yes, its easiest
I just learned it through the roblox platformer template
yes, but more properties and stuff
@slender kraken
and attachements confused me at first but now, its good
-- you need to define the player first
local HRP = player.Character.HumanoidRootPart
local Part = Instance.new("Part", workspace) -- the part to move
Part.CFrame = HRP.CFrame * CFrame.new(0,0,-3) -- Putting the part infront of the player
local Attachment = Instance.new("Attachment", Part) -- the attachment used in Linearvelocity
local LV = Instance.new("LinearVelocity", Attachment) -- creating the linear velocity
LV.MaxForce = math.huge -- no need to worry about this
LV.VectorVelocity = HRP.CFrame.lookVector * 100 -- change 100 with how fast you want the projectile to go
LV.Attachment0 = Attachment -- setting the attachment
game.Debris:AddItem(Part, 2) -- deletes the moving part after 2 second
it will still flung the player
you need to do some maths
how can i prevent the player from flinging?
because i currently use linearvelocity but it flings
lemme send you my roll script
its easy
local ROLL_DURATION = 0.2
local ROLL_FORCE = 100
local ROLL_COOLDOWN = 5
local Roll = {}
function Roll.Start(plr : Player, track : AnimationTrack, sound : Sound )
if not canRoll then return end
canRoll = false
task.delay(ROLL_COOLDOWN, function()
canRoll = true
end)
local char = plr.Character or plr.CharacterAdded:Wait()
local Humanoid = char:WaitForChild("Humanoid")
local hrp : BasePart = char:WaitForChild("HumanoidRootPart")
local attachment = Instance.new("Attachment")
attachment.Parent = hrp
local linearVelocity = Instance.new("LinearVelocity")
linearVelocity.Attachment0 = attachment :: Attachment
linearVelocity.RelativeTo = Enum.ActuatorRelativeTo.Attachment0
linearVelocity.MaxForce = 1500 * hrp.AssemblyMass
linearVelocity.VectorVelocity = Vector3.new(0, 0, - ROLL_FORCE)
linearVelocity.Parent = hrp
local sound = sound:Clone()
sound.Parent = hrp
track:Play()
sound:Play()
game.Debris:AddItem(linearVelocity, ROLL_DURATION)
game.Debris:AddItem(sound, ROLL_DURATION)
end
return Roll ```