#Help With Command Script

1 messages · Page 1 of 1 (latest)

flint cradle
#

I'm trying to make a tp command but I'm getting the error "attempt to index nil with CFrame"

    local part
    local firstpart = workspace:FindFirstChild(args[3])
    for _, directedplayer in game.Players:GetChildren() do
        if string.sub(string.lower(player.Name), 1, string.len(args[2])) == string.lower(args[2]) then
            for i = 3, #args - 3 do
                if i == 3 then
                    part = firstpart
                else
                    part = part:FindFirstChild(args[i])
                end    
            end
            player.Character.HumanoidRootPart.CFrame = part.CFrame
        end
    end
end```
ocean creek
#

Print it out. Is the player's root part nil? or is it part?

flint cradle
#

the part is nil