You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
I’ve been having a persistent bug where I’m trying to use this new Hitbox system I implemented and for some reason it comes up with this error during the return-part or if I miss and so on. It’s really finnicky and confuses me a ton!
I’ve been attempting to change the returns up, use new things. Fix it up.. It’s very confusing..
Error:
03:02:37.277 Script that implemented this callback has been destroyed while calling async callback - MovesetModule:88
03:02:37.278 Stack Begin
03:02:37.278 Script 'Workspace.Default.Battlers.ImChromez.Config.MovesetModule', Line 88 - function Ability1 - MovesetModule:88
03:02:37.278 Script 'ServerScriptService.CoreScripts.Server', Line 253 - Server:253
Server:
local EndEarly = MovesetModule[Prefix](Player, PlayerData, DamageMultiplier)
Moveset:
local TargetModel = RemoteFunctions.GetHitboxData:InvokeClient(Player, {
["HitboxSize"] = Vector3.new(5,2,5),
["HitboxDebounce"] = 0.325,
["Timer"] = 0.3,
["Offset"] = CFrame.new(0,0,-2.5),
["AutoSend"] = true,
})
I’m genuinely unsure what to do!
Full Code:
local function SafeFind(instance, className)
if instance then
return instance:FindFirstChildOfClass(className)
end
return nil
end
local function IsValid(instance)
return instance ~= nil and instance.Parent ~= nil
end
function Moveset.Ability1(Player:Player, PlayerData)
local Info = PlayerData.Info
local Character = Player.Character
local States = Player.States
FuncAssistor.PlayCharSound(PlayerData, "Character", "M1_Grasp", Character.PrimaryPart)
FuncAssistor.PlayAnimation(Player, "Ability", "A1_Init", {["Priority"] = Enum.AnimationPriority.Action})
local TargetModel = RemoteFunctions.GetHitboxData:InvokeClient(Player, {
["HitboxSize"] = Vector3.new(5,2,5),
["HitboxDebounce"] = 0.325,
["Timer"] = 0.3,
["Offset"] = CFrame.new(0,0,-2.5),
["AutoSend"] = true,
})
local EnemyTable = TargetModel and TargetModel.HitCharacters or {}
if #EnemyTable > 0 then
local EnemyChar = EnemyTable[#EnemyTable]
local EnemyHum = SafeFind(EnemyChar, "Humanoid")
local EnemyPrimary = EnemyChar and EnemyChar.PrimaryPart
local EnemyStates = EnemyChar and EnemyChar:FindFirstChild("States")
if States and States:FindFirstChild("Immobile") then
States.Immobile.Value = true
end
if EnemyStates and EnemyStates:FindFirstChild("Immobile") then
EnemyStates.Immobile.Value = true
end
local NewIFrame = FuncAssistor.ApplyIFrame(EnemyChar, Character)
local PlayerIFrame = FuncAssistor.ApplyIFrame(Character, nil)
Debris:AddItem(PlayerIFrame, 5)
local NewWeld
if EnemyChar then
NewWeld = Instance.new("WeldConstraint", EnemyChar)
NewWeld.Name = "GrabWeld"
local TargetPartName = EnemyChar:FindFirstChild("Head") and "Head" or "HumanoidRootPart"
local TargetPart = EnemyChar:FindFirstChild(TargetPartName)
if TargetPart and Character:FindFirstChild("Left Arm") then
TargetPart.Position = Character["Left Arm"].Position - Vector3.new(0,0.75,1)
task.wait()
if Character:FindFirstChild("Handle") then
NewWeld.Part0 = Character["Handle"]
NewWeld.Part1 = TargetPart
end
end
end
local UniqEnemyID = EnemyChar and EnemyChar:GetAttribute("UniqueId")
local UniqPlayerID = Character and Character:GetAttribute("UniqueId")
FuncAssistor.TakeDamage(UniqEnemyID, UniqPlayerID, Settings.Ability1.GrabDamage)
if EnemyChar and EnemyChar:FindFirstChild("RagdollTrigger") then
EnemyChar.RagdollTrigger.Value = true
end
FuncAssistor.PlayAnimation(Player, "Ability", "A1_Hit", {["Priority"] = Enum.AnimationPriority.Action})
FuncAssistor.PlayCharSound(PlayerData, "Character", "EnemyStruggle", EnemyPrimary)
task.wait(0.3)
FuncAssistor.IndicateDamage("OUT OF MY WAY.", Character.PrimaryPart, Character.Torso.Color)
for I=0,1,0.1 do
if not IsValid(EnemyChar) or not IsValid(EnemyHum) or not IsValid(EnemyPrimary) then break end
local enemyPlayer = ServPlayers:GetPlayerFromCharacter(EnemyChar)
if enemyPlayer then
FuncAssistor.PlayerTakeDamage(enemyPlayer, Character, Settings.Ability1.TickDmg)
else
FuncAssistor.TakeDamage(UniqEnemyID, UniqPlayerID, Settings.Ability1.TickDmg)
end
FuncAssistor.PlayCharSound(PlayerData, "Character", "BoneSnap1", EnemyPrimary)
task.wait(0.1)
end
local ThrowDirection = 350 * 1.25
local ThrowPower = 650 * 1.25
FuncAssistor.IndicateDamage("GOOD RIDDANCE.", Character.PrimaryPart, Character.Torso.Color)
task.spawn(function()
for I=0,1,0.1 do
if not IsValid(EnemyPrimary) then break end
pcall(function()
FuncAssistor.EmitBlood(EnemyPrimary, math.random(2,4), nil)
end)
task.wait(0.1)
end
end)
if IsValid(NewWeld) then NewWeld:Destroy() end
if IsValid(EnemyHum) and EnemyHum.Health <= 0 then
print("dead")
else
FuncAssistor.IndicateDamage("GET OUT.", Character.PrimaryPart, Character.Torso.Color)
FuncAssistor.PlayCharSound(PlayerData, "Character", "EnemyFree", EnemyPrimary)
end
if EnemyChar and EnemyChar:FindFirstChild("RagdollTrigger") then
EnemyChar.RagdollTrigger.Value = true
end
local DirectionForce = (Character.PrimaryPart.CFrame.LookVector * ThrowDirection) + Vector3.new(0,ThrowPower,0)
if IsValid(EnemyPrimary) then
EnemyPrimary:ApplyImpulse(DirectionForce)
end
task.wait(0.75)
FuncAssistor.PlaySound(Assets.Sounds.RockBreak, EnemyPrimary)
FuncAssistor.FormCrater(EnemyPrimary.Position, 15, 2.5)
local enemyPlayer = ServPlayers:GetPlayerFromCharacter(EnemyChar)
if enemyPlayer then
FuncAssistor.PlayerTakeDamage(enemyPlayer, Character, Settings.Ability1.GrabDamage, true)
else
FuncAssistor.TakeDamage(UniqEnemyID, UniqPlayerID, Settings.Ability1.GrabDamage, true)
end
if IsValid(PlayerIFrame) then PlayerIFrame:Destroy() end
if IsValid(NewIFrame) then NewIFrame:Destroy() end
if EnemyStates and EnemyStates:FindFirstChild("Immobile") then
EnemyStates.Immobile.Value = false
end
if EnemyChar and EnemyChar:FindFirstChild("RagdollTrigger") then
EnemyChar.RagdollTrigger.Value = false
end
if States and States:FindFirstChild("Immobile") then
States.Immobile.Value = false
end
return false
else
RemoteEvents.MissedEffect:FireClient(Player)
return true
end
end