Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

ive been watching this return tutorial on youtube... but i am confused. can someone help? (ANSWERED)

--so this line of code:

local partReturned  = createPart(0.5,Color3.fromRGB(255, 0, 0),true)
partReturned.Color = Color3.fromRGB(0,255,0)

--shouldnt this create 2 parts?
-- if you make a variable of a function, shouldnt that make a part as well?

--can someone explain?

2 comments

0

partReturned was only called once. After it was called, you changed it's colour. If you did "createPart(blah).Color = blah", then it would've called twice.

0

no it wouldnt have

1 answer

✓ Accepted answer

The code above wont create 2 parts. The createPart function only gets called once, then you assign a variable (partReturned) to the part that gets returned. Reading or writing the variable you assigned to the returned part doesn’t call the function again to create another part.

This discussion is preserved as it was. New answers, comments, and votes are closed.