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

Is this the correct way to use built in functions?[SOLVED ON ANOTHER POST]

Hello Fellow Scripters! So this is what I am trying to make: First, you wait 3 seconds then a part will be cloned at this position; (60, 34, 59), and a message will be printed into the output. After that you will wait 5 seconds and the cloned part will be destroyed. Then, some text will be printed again 4 seconds the part was destroyed. Please correct me if I am incorrect! Thanks!

My Code:

wait(3)

local myClone = game.Workspace.Part:Clone()
myClone.Position = (60, 34, 59)

print(The Part has been cloned.)

wait(5)

myClone:Destroy()

wait(4)

print(HAHA That part has been deleted!)
--This should work right?
--Answer if you the answer to this question.

Question(s): On line 3 when we used a variable to define the cloned part, on line number 10 do we still have to call the part "myClone"???

Please do not forget to answer both questions above.

Well thanks for helping. :D

Correct Answered code a fellow scripter helped with:


wait(3)

local myClone = game.Workspace.Part:Clone()
myClone.Position = Vector3.new(60, 34, 59)

print("The Part has been cloned.")

wait(5)

myClone:Destroy()

wait(4)

print("HAHA That part has been deleted!")
--This should work right?
--Answer if you the answer to this question.

1 answer

✓ Accepted answer

Hello there, yes that is the correct way of doing it. Yes you will need to call the myClone part on line 10. I would also put "" on your prints, Heres the edited script:

wait(3)

local myClone = game.Workspace.Part:Clone()
myClone.Position = Vector3.new(60, 34, 59)

print("The Part has been cloned.")

wait(5)

myClone:Destroy()

wait(4)

print("HAHA That part has been deleted!")
--This should work right?
--Answer if you the answer to this question.

6 comments

0

Thank you very much. It usually takes a long time to get an answer!

0

Not a problem! Glad to help.

0

You should be casting a Vector3 to the position property...

0

He is correct, just edited the script. Completely forgot about that part.

0

OOF! Well thanks to Ziffixture AND 0Vyp!!!

0

UH, I didn't work...

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