Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Nothing past the parts variable parses when running my ability script?

Asked by 1 year ago

Im trying to make a simple ability (note i made it so the player is detected on purpose for debugging)

Script in ServerScriptService

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SecularDirectory = ReplicatedStorage.Abilities.Secular

SecularDirectory["Soul Piercer"].Cast.OnServerEvent:Connect(function(player)
    if player.stats.soul.Value >= 20 then
        local char = player.Character
        local hum = char:WaitForChild("Humanoid")

        local Anim = hum:LoadAnimation(SecularDirectory["Soul Piercer"].Animation)
        Anim.Looped = true

        Anim:Play()
        --// Parenting \\--
        local SoulPierce = SecularDirectory["Soul Piercer"].SoulPierce:Clone()
        SoulPierce.Parent = char
        SoulPierce.HandWeld.Part1 = char["Left Arm"]

        --// Hitbox Detecting \\--
        local parts = game.Workspace:GetPartsInPart(SoulPierce.Hitbox)

        print(parts)

        for i, v in parts do
            if v.Parent:WaitForChild("Humanoid") then
                if v.Parent:FindFirstChildOfClass("Tool") then
                    local enemy = game.Players:GetPlayerFromCharacter(v.Parent)

                    local statsFolder = enemy:WaitForChild("stats")
                    local posture = statsFolder:WaitForChild("posture")

                    posture.Value -= 10

                end
            end
        end
        wait(0.1)
        SoulPierce:Destroy()
    end
end)

Also yes, the part spawns, gets welded, and the animation plays, my only issue is with everything BELOW the "local parts = game.Workspace:GetPartsInPart(SoulPierce.Hitbox)" and yes there is 0 errors.

Answer this question