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

Can someone tell me why my cloned item keeps coming back nil?

Asked by 5 years ago

Okay, so basically I've been trying to clone the player.Character in a server script, but it keeps saying "attempt to index local 'Astral' (a nil value)" even though Its not a nil value. Does anyone know whats happening?

local PrueFire = game.ReplicatedStorage.Prue


PrueFire.OnServerEvent:Connect(function(Player,Spell,Misc)


    if Spell == "Astral" then

    local Char = Player.Character
        if Char then
        local Astral = Char:Clone()
        Astral.Parent = workspace
        end

    end







end)






0
I have been playing around with it for 30 minutes, but I cant get it to work. Witchest 48 — 5y

1 answer

Log in to vote
0
Answered by
Vulkarin 581 Moderation Voter
5 years ago
Edited 5 years ago

This question was previously answered here, you need to set the Archivable property of Character to true

local PrueFire = game.ReplicatedStorage.Prue


PrueFire.OnServerEvent:Connect(function(Player,Spell,Misc)

    if Spell == "Astral" then

        local Char = Player.Character
        if Char then
            Char.Archivable = true
            local Astral = Char:Clone()
            Astral.Parent = workspace
        end
    end
end)

0
Thank you so much! Witchest 48 — 5y
0
No problem Vulkarin 581 — 5y
Ad

Answer this question