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

Change name by one when duplicated?

Asked by
Dexiber 272 Moderation Voter
1 year ago

For example, there is a part that is named: "Part(1)". When duplicated, it should change the number in the brackets by one. So when "Part(1)" is duplicated it would be named "Part(2)", and so on.

Is there a setting for this?

0
No, but probably through through the use of a plugin Rare_tendo 3000 — 1y

2 answers

Log in to vote
0
Answered by
MattVSNNL 620 Moderation Voter
1 year ago

Hello,

This is a very easy script so I'm gonna explain it!

If the script works I'd appreciate you accepting my answer!

Create a part and put it in ReplicatedStorage!

Script in ServerScriptService (Not a LocalScript and not a ModuleScript)

local replicatedStorage = game:GetService("ReplicatedStorage") -- Create a variable to easily get the ReplicatedStorage

local part = replicatedStorage:FindFirstChild("Part") -- Create a variable to easily get the part

local partAmount = 0 -- Create a Variable to count the amount of parts!

while wait(1) do -- This will run every second

    partAmount += 1 -- Add 1 to the part amount

    local newPart = part:Clone() -- Clone the part
    newPart.Name = "Part"..partAmount -- Name the part "Part" plus the amount of parts (The name of the part would be Part1)
    newPart.Parent = workspace -- Put the parts parent to workspace

end
Ad
Log in to vote
0
Answered by
enes223 327 Moderation Voter
1 year ago

hey you! have you ever heard of enes? if you are in trouble, better call enes!

Answer this question