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

Printing a "local" value didn't work?

Asked by 5 years ago

Another yet LUA question, so that's preferred code below:

local P2000 = game.Workspace.P200Model
print(P200Model)

Now i am showing expected output (the output on other is unexpected);

-- P200Model

Now to output it did:

game.Workspace.P200Model is not local

(its wrong probably but i didnt check)

0
The variable is P2000 not P200Model and you can't just print a model, you need to print it's name or any of it's attributes. Divistern 127 — 5y

1 answer

Log in to vote
0
Answered by
JakyeRU 637 Moderation Voter
5 years ago

Hello.

Sometimes, Scripts and LocalScripts load faster than the actual models in game. Your model P2000 is an Object. So you cannot dirrectly print it. Instead, you could do:

local MyModel = game.Workspace:WaitForChild("P200Model")
print(MyModel.Name) -- Name it's a Property.
Ad

Answer this question