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

i feel like an idiot for not knowing this but how do i rename a model?

Asked by 3 years ago

ok so I did

local character = script.parent
local name = character.Name


name = "anythingiwant"

There is no errors but the name doesn't change I feel like an idiot

2 answers

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

I think your problem is that you didn't capitalize Parent, also you could make your script shorter by doing this:

local character = script.Parent
character.Name = [Name Here]

or even shorter like this:

script.Parent.Name = [Name Here]

If it's in a script not under the model, you would do do game.workspace.[ModelNameHere].Name = [NewModelName] . However if the model is in a different location such as ReplicatedStorage, Change the workspace to the location.

Ad
Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

The problem is that when you change the value of the variable you lose the reference to the object/value you put in the first place.

So instead of saying:

local name = character.Name

name = "NameHere" -- Now you can't access the character's name anymore

do:

character.Name = "NameHere"

When making variables, only put the object inside it, so you can access the properties without losing reference.

I hope this helps!

0
OH so i see what i did oops LTRNightmare 66 — 3y

Answer this question