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

finding a part thats a variable (EASY)?

Asked by 6 years ago
Edited 6 years ago

So I'm trying to change the name of a part that's a variable but when I do the following script

local part1 = script.Parent
local part2 = game.Workspace.Baseplate
part1.Name = game.Workspace.part2.Name

it tries to find a part in workspace called part2 but I want it to find the variable. is there a way to do this by keeping it as a variable?

2 answers

Log in to vote
1
Answered by
amanda 1059 Moderation Voter
6 years ago

If you have a variable for its path, you don't have to write its path ever again.

So you can just do:

local part1 = script.Parent
local part2 = game.Workspace.Baseplate
part1.Name = part2.Name

If you would like to make part1 named the same as part2.

Ad
Log in to vote
0
Answered by 6 years ago

You dont have to write all path again cause you already have path2 variable.

Answer this question