-
What do you want to achieve? I want my character physics not to bug out after using certain abilities.
-
What is the issue? (In video attached) First I show how my normal jumping is, and then use an ability in my game, after using the ability, i jump around again but i am specifically trying to jump backwards, my jumping is buggy and flings me arround occasionally similar to those old roblox vehicles that make you fling super far.
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Yes, but since its such a odd situation, the only things i could find were situations where it was roblox’s physics engine causing the issue, as for here, i have no idea. Previously in earlier versions this wasnt the case, even in moves i havent changed in a long time, they started causing this, it seems to occur typically in 2 player moves such as the one shown.
My ability code: (please do ask if you want to see some of the modules and etc not shown in this script block)
function Coded.InfiniteDropkick(Player:Player)
if not Player or not Player.Character then return end
local Char = Player.Character
local Hum = Char:FindFirstChildOfClass("Humanoid")
local HRP = Char.HumanoidRootPart
local Torso = Char.Torso
if not Hum or not HRP or not Torso then
return
end
if Char:GetAttribute("Attacking") == true then
warn("Attacking already bozo")
return
end
Char:SetAttribute("Attacker", true)
Hum.WalkSpeed = 0
Hum.JumpPower = 0
local isMovementEnabled = false
local hit = false
local Animation = ANIMS:WaitForChild("InfiniteDropkickWindup")
local LoadAnimation:AnimationTrack = Hum:LoadAnimation(Animation)
LoadAnimation.Priority = Enum.AnimationPriority.Action4
LoadAnimation:Play()
LoadAnimation.Ended:Connect(function()
LoadAnimation:Stop()
end)
SlowService.Stun(Hum,1.1,0)
local move = Instance.new("BodyVelocity")
move.MaxForce = Vector3.new(math.huge,0,math.huge)
move.Velocity = Vector3.new(1,1,1) * HRP.CFrame.LookVector * 200
move.P = 1000000
move.Parent = HRP
local c1
c1 = Char:GetAttributeChangedSignal("Stunned"):Connect(function()
if Char:GetAttribute("Stunned") == true then
c1:Disconnect()
isMovementEnabled = false
hit = true
DBS:AddItem(move,0)
LoadAnimation:Stop()
Hum.WalkSpeed = 16
Hum.JumpPower = 50
Char:SetAttribute("Attacker",false)
end
end)
local function moveForward(Speed)
if isMovementEnabled then
-- Calculate the velocity based on the root part's rotation
local velocity = HRP.CFrame.LookVector * 200
if Speed then
velocity = HRP.CFrame.LookVector * 200 / Speed -- Adjust speed as needed
end
-- Apply velocity
move.Velocity = velocity
else
if move then
move.Velocity = Vector3.new(0, 0, 0) -- Stop movement
move:Destroy()
end
end
end
local Hitboxnew = HitboxModule.new()
Hitboxnew.Size = Vector3.new(8,5,15)
Hitboxnew.CFrame = HRP
Hitboxnew.Offset = CFrame.new(0,0,-7.5)
Hitboxnew.onTouch = function(humanoid) --detects when the hitbox is touched
if humanoid ~= Hum and not humanoid.Parent:GetAttribute("IFrame") and not humanoid.Parent:GetAttribute("InAttack") and not humanoid.Parent:GetAttribute("Blocking") and not Char:GetAttribute("Stunned") and humanoid.Health > 0 and not hit then
hit = true
humanoid.Parent:SetAttribute("Stunned", true)
humanoid.Parent:SetAttribute("InAttack", true)
Char:SetAttribute("IFrame", true)
Char:SetAttribute("InAttack", true)
c1:Disconnect()
local OtherChar = humanoid.Parent
local OtherTorso = OtherChar.Torso
local EHRP = humanoid.Parent.HumanoidRootPart
LoadAnimation:Stop()
local AttackerAnimation = Hum:LoadAnimation(ANIMS.InfiniteDropkickAttacker)
AttackerAnimation.Priority = Enum.AnimationPriority.Action4
AttackerAnimation:Play(0)
AttackerAnimation.Ended:Connect(function()
AttackerAnimation:Stop(0)
end)
local MAINVFX = VFX.InfiniteDropkick
local VictimAnimation = humanoid:LoadAnimation(ANIMS.InfiniteDropkickVictim)
VictimAnimation.Priority = Enum.AnimationPriority.Action4
VictimAnimation:Play(0)
VictimAnimation.Ended:Connect(function()
VictimAnimation:Stop(0)
end)
Hum.AutoRotate = false
humanoid.AutoRotate = false
task.spawn(function()
for i = 1,8 do
if HRP and EHRP then
HRP.Anchored = true
EHRP.Anchored = true
Configs.BindPlayers(Player, Char, humanoid.Parent, CFrame.new(0,0,0), false)
HRP.Anchored = true
EHRP.Anchored = true
task.wait(.1)
end
end
end)
task.wait(.3)
local HitEffect = MAINVFX.Victim:Clone()
DBS:AddItem(HitEffect,3)
if OtherChar and OtherChar:FindFirstChild("Head") then
HitEffect.Parent = OtherChar.Head
for i,v in pairs(HitEffect:GetChildren()) do
v:Emit()
end
end
task.wait(.433)
local CharEffect = MAINVFX.Attacker:Clone()
if Char and Torso then
CharEffect.Parent = Torso
for i,v in pairs(CharEffect:GetChildren()) do
if v:IsA("ParticleEmitter") then
v:Emit()
end
end
end
local Player2 = game.Players:GetPlayerFromCharacter(OtherChar)
local CSRemote = Remotes:WaitForChild("NewCutscene")
if Player then
CSRemote:FireClient(Player, "Coded", "InfiniteDropkick", 9.267, HRP)
end
if Player2 then
CSRemote:FireClient(Player2, "Coded", "InfiniteDropkick", 9, HRP)
end
task.wait(3.3)
DBS:AddItem(CharEffect,0)
task.wait(5.7)
if EHRP and humanoid then
EHRP.CFrame = EHRP.CFrame * CFrame.new(0,0,3)
task.wait(.02)
EHRP.Anchored = false
humanoid.AutoRotate = true
humanoid.Parent:SetAttribute("Stunned", false)
humanoid.Parent:SetAttribute("InAttack", false)
local Damage = 50
local Center = (EHRP.Position - HRP.Position).Unit
local knockback = Center * 150
HitService.Hit(humanoid, Damage, 3, knockback, true, 3, Player)
local HitEffect2 = MAINVFX.Victim:Clone()
DBS:AddItem(HitEffect2,3)
if OtherChar and OtherChar:FindFirstChild("Head") then
HitEffect2.Parent = OtherChar.Head
for i,v in pairs(HitEffect2:GetChildren()) do
v:Emit()
end
end
end
task.wait(.267)
if HRP and Hum and Char then
HRP.Anchored = false
Hum.AutoRotate = true
Char:SetAttribute("IFrame", false)
Char:SetAttribute("InAttack", false)
Char:SetAttribute("Attacker", false)
end
end
end
task.spawn(function()
task.wait(.2)
Hitboxnew:Start()
task.wait(.5)
Hitboxnew:Stop()
Hitboxnew:Destroy()
end)
local Speed = 2
task.spawn(function()
isMovementEnabled = true
task.wait(.8)--endofrun
isMovementEnabled = false
DBS:AddItem(move,0)
task.wait(.3)
if hit == false and Char and Hum then
Hum.WalkSpeed = 16
Hum.JumpPower = 50
Char:SetAttribute("Attacker",false)
c1:Disconnect()
end
end)
repeat
moveForward(Speed)
print(Speed)
wait()
until isMovementEnabled == false
end
Quick summary of the script above:
Start: windup animation with velocity and hitbox
Hitbox function that begins the cutscene and effects
Players anchored and put in same position and rotation via “BindPlayers”
Cleanup
End
Video mentioned: (Linked due to file size limits)