#Tool not appearing in character

1 messages · Page 1 of 1 (latest)

eager fiber
#

I have a module function that gives the player the sword they have equipped and parents it to their character, only sometimes the tool doesnt appear, and you cant activate it.

    local profile = Profiles[player.UserId]
    if profile then
        local equippedSword = profile.Data.EquippedSword
        local swordModel = ReplicatedStorage.Models.Swords:FindFirstChild(equippedSword)
        if swordModel then
            print("giving " .. player.Name .. " their sword : " .. equippedSword)
            local clonedSword = swordModel:Clone()
            clonedSword.Parent = player.Character or player.CharacterAdded:Wait()
            print("sword given for " .. player.Name)
            return true
        else
            warn("sword not found : " .. equippedSword)
            return false
        end
    else
        warn("Profile not found for", player.Name)
    end
end```

I have all the prints for debugging and it succesfully says "giving sword" and "sword given" so im not sure what would be causing it. Whats weird is that the player has their arms out as if they have it equipped. 

Attached is an example of a player without their sword even thought it printed it had given it.
magic inlet
#

i don't think you can do clonedsword.parent = player.CharacterAdded:Wait() if the character doesn't load in time for player.character

eager fiber
#

wdym

#

in doing player.character or player.characteraddedwait

#

so either one will be its parent

magic inlet
#

try local playerchar = player.Character or player.CharacterAdded:Wait

#

then swordclone.Parent = playerchar

eager fiber
#

ok

eager fiber
#

@magic inlet dint work