How do you use local name?

Hi! This is my first post however. I’m trying to get the local name or such as “variables” name. I tried to work around with this with many ways as possible, but I just don’t know how to do it right or… I just don’t know how to do it.

I tried to look through the dev forum and asking on other coding group and mostly I can’t find what am looking for.

I want to get the local name to be as some instance’s value through the code. Here a few ways I think to make this work: Make a script that auto do it or a script that scan through the code and change the part name by it. I don’t know what to explain more so I hope we can help me know how to do this.

1 Like

change string to Instance name

local name = ""

name = Instance.Name

check if instance name is string

local name = "Part"
if Instance.Name == name then
--do stuff
end

Sorry, but I am not too sure what you’re trying to archieve.

Do you mean a thing that makes a script for you?

Edit: i think you mean is you want to change variable name? You can’t change the variable name, just it’s value

You could create a new variable with a different name and set it to the old variable’s value.

If you could say what you’re trying to do that would make it easier.

What I’m trying to do here is pretty hard to explain. Here an example code and how what I would like it to look like

local TemporaryIceSpike = Instance.new("Part")
TemporaryIceSpike.name = "TemporaryIceSpike"
--So instead of doing that manually for many parts is there anyways that I can make a script that automatically do the progress?
for _, v in pairs(Spikes:GetChildren()) do
if v:IsA("BasePart") then
v.Name = "TemporaryIceSpike"
end

How about for many specific name?
Like:

local TemporaryIceSpike = Instance.new("Part")
local ClonedIceSpike = TemporaryIceSpike:Clone()
--Some script that will automatically rename the part that got created with it local name

The thing is I wanted to change the part name through local name.

Ah… I need to go now. See you tomorrow I guess.

local name = "TemporaryIceSpike"
ClonedIceSpike = TemporaryIceSpike:Clone()

ClonedIceSpike.Name = name

Could you tell me what exactly you mean by “local name”?

Oh it easy. I don’t know what it called to be honest. I only know how to show it.

local something = somethings

Something is a name you that give for the variable when making a local. I want to use that name to change parts name automatically.

I’m trying to make an automatically progress that will change every instance name to it local name. So that it easier for me to check the error and what disturb the code.

Oh if so then I guess ima need to do somethings else.