Error with attempt to index nil with 'Clone'

  1. What do you want to achieve? Keep it simple and clear!
    i want to make it when textlabel is my mom, then it’ll clone a model to wspace

  2. What is the issue? Include screenshots / videos if possible!
    Players.AamTum.PlayerGui.main.timer.if:8: attempt to index nil with ‘Clone’

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    checking every var if i misspell anything

local textLabel = script.Parent
local serverStorage = game:GetService("ServerStorage")

    if textLabel.Text == "my mom" then
                local clone = modelToClone:Clone()

I assume this is a client script?

Certain areas in game are not accessible to players, such as ServerScriptService and ServerStorage. Because of this, ServerStorage will appear as blank to all players.

I would recommend that you move the model into ReplicatedStorage and clone it from there, as the contents of ReplicatedStorage is replicated to the client.

ok tysm it works, but 1 thing thats my model is npc, so after npc cloned, its not moving or jump, just standing

Is there a script that is meant to make it move?
If there is, i assume it would be a server script in which case you should use RemoteEvents and clone the NPCs on a server script.

1 Like