#SetAttribute works and doesnt work randomly help please

1 messages · Page 1 of 1 (latest)

finite crow
#

So sometimes I press play and it works and sometimes it doesnt. This is a serverscript inside of serverscriptservice btw

Players.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function(char)
        local hum = char:WaitForChild("Humanoid")
        local torso = char:WaitForChild("Torso")
        local rightArm = char:WaitForChild("Right Arm")
        local leftArm = char:WaitForChild("Left Arm")
        
        --
        
        char:SetAttribute("Equipped", false)
        char:SetAttribute("CurrentWeapon", "Fists")
        char:SetAttribute("Combo", 1)
        char:SetAttribute("Stunned", false)
        char:SetAttribute("Swing", false)
        char:SetAttribute("Attacking", false)
        char:SetAttribute("IsParrying", false)
        char:SetAttribute("IsBlocking", false)
        char:SetAttribute("IsSprinting", false)
        char:SetAttribute("IsWalking", true)
        char:SetAttribute("IsKnocked", false)
        
        char.Parent = workspace.Characters
    end)
end)
devout path
#

I'd say sometimes your character loads too fast and the waitforchild becomes an infinite yield

finite crow
#

So dont think its that

#

And I did waitforchild since I thought it would help

#

Before there was no wait for child

devout path
#

or smth

finite crow
#

I even tried making this

#
-- In ModuleScripts/CharacterUtils
local module = {}

function module.Initiate(char)
    print("Setting Attributes")
    print(char)
    
    if char:GetAttribute("Equipped") == nil then
        char:SetAttribute("Equipped", false)
    end

    if char:GetAttribute("CurrentWeapon") == nil then
        char:SetAttribute("CurrentWeapon", "Fists")
    end

    if char:GetAttribute("IsParrying") == nil then
        char:SetAttribute("IsParrying", false)
    end

    if char:GetAttribute("IsBlocking") == nil then
        char:SetAttribute("IsBlocking", false)
    end

    if char:GetAttribute("IsSprinting") == nil then
        char:SetAttribute("IsSprinting", false)
    end

    if char:GetAttribute("IsWalking") == nil then
        char:SetAttribute("IsWalking", true)
    end

    if char:GetAttribute("IsKnocked") == nil then
        char:SetAttribute("IsKnocked", false)
    end
    
    if char:GetAttribute("EquipCooldown") == nil then
        char:SetAttribute("EquipCooldown", false)
    end
end

return module
#

And calling it

#

but that didnt work

devout path
finite crow
#

i didnt set it to humanoid

#

Wait where did I set to humanoid

#

??

#

OHHHHHHHH

#

I WAS CHECKING

#

THE HUMANOIDS ATTRIBUTES

#

Ok

devout path
finite crow
#

Thanks

devout path
#

np

#

gl on ur game, it looks interesting 🙂

finite crow
#

Althought why does it sometimes go into the humanoids attributes

finite crow
finite crow
#

Since thats how I've been checking this whole time

devout path