- **What do you want to achieve?
a Dashing system that makes the player dash when attacking (M1) and creates the hitbox in front of him using LinearVelocity
In this short clip i used TweenService for dashing to show you what im trying to achieve:
- What is the issue? Include screenshots / videos if possible!
Before i was using BodyVelocity to make the player dash but since it got Deprecated i switched to LinearVelocity which is now giving me this problem…
Im using muchacho’s hitbox module and as you can see in the clip the hitboxes are being created in the wrong position.
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
it’s been 5 days and i’ve tried everything i could. Devforum couldn’t answer my questions, and so i created this, my first thread.
Here are the pieces of code that im using.
ServerScriptService Script:
(i commented both Tween and LinearVelocity calls in here)
if input == "m1" and CombatFunctions.CanAttack(humanoid) then
if CombatFunctions.Combo(humanoid) == MaxCombo then -- IF COMBO IS MAX, RESET COMBO.
CombatFunctions.setCanAttack(humanoid, false)
CombatFunctions.setCombo(humanoid,0)
task.delay(2, function() CombatFunctions.setCanAttack(humanoid, true) end) -- Make player able to Attack
return
end
CombatFunctions.setCombo(humanoid,1) -- COMBO +1
CombatFunctions.ComboTimer(humanoid, CombatFunctions.Combo(humanoid))
CombatFunctions.setCanAttack(humanoid, false)
CombatFunctions.CanWalk(humanoid, false)
--CombatFunctions.LinearVelocity(humanoid, 0.03)
--CombatFunctions.Tween(humanoid, humanoid, 0.21, Enum.EasingStyle.Exponential)
Animation.AnimationId = EffectsModule.Animations[SelectedCharacter].M1[CombatFunctions.Combo(humanoid)]
load = Animator:LoadAnimation(Animation)
load:Play(.3,3, AttackSpeed + CombatFunctions.AtkSpdBonus(humanoid) ) -- PLAY M1 Anims
----------------- HITBOX SPACE -----------------
local hitbox = MuchachoHitbox.CreateHitbox()
hitbox.Size = Vector3.new(3.5,6,4.5)
hitbox.Offset = CFrame.new(0,0,-3)
hitbox.CFrame = humanoid.RootPart
hitbox.Visualizer = CombatFunctions.HitboxVisualizer(humanoid)
-- SWING SOUND
--M1SwingSound(humanoid)
load.Stopped:Connect(function() -- On animation stopped, start M1 combo time
if not CombatFunctions.Stunned(humanoid) then
hitbox:Start()
task.delay(.2-CombatFunctions.AtkSpdBonus(humanoid)/2, function()
CombatFunctions.CanWalk(humanoid, true)
hitbox:Stop()
end)
CombatFunctions.setCanAttack(humanoid, true)
end
end)
Module that uses Tween or LinearVelocity
function CombatOutput.Tween(humanoid, target, Time, Style)
local TwInfo = TweenInfo.new(Time, Style)
ts:Create(humanoid.RootPart, TwInfo, {CFrame = CFrame.new(humanoid.RootPart.Position + humanoid.RootPart.CFrame.LookVector * 4)*humanoid.RootPart.CFrame.Rotation}):Play()
end
function CombatOutput.LinearVelocity(humanoid, duration)
local lv = Instance.new("LinearVelocity", humanoid.RootPart.RootAttachment)
lv.Attachment0 = lv.Parent
lv.MaxForce = math.huge
lv.VectorVelocity = humanoid.RootPart.CFrame.LookVector * 65
game.Debris:AddItem(lv, duration)
end
So, as you can see the only way to implement the dash is by using TweenService but i would like to use LinearVelocity instead for better performance and easier use.
Any help is appreciated.