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

What does this built in function script do?( Involves Variables and Built in Functions) [closed]

Asked by 7 years ago

part = script.Parent

part.Touched:connect(function() local awesomePart = game.Lighting.AwesomePart:Clone() awesomePart.Parent = game.Workspace

end)

I don't understand it

1
Which part do you not understand in this code? User#5423 17 — 7y

Closed as Not Constructive by davness, InfinitivePixelsJr, and BlueTaslem

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

2 answers

Log in to vote
0
Answered by 7 years ago

It clones the part when you touch the part and makes the parent of the cloned part Workspace.

Ad
Log in to vote
2
Answered by 7 years ago
part = script.Parent --This defines the parent of the script, which is the part.

part.Touched:connect(function()  --When the part has been touched by any other object, the function will execute.
    local awesomePart = game.Lighting.AwesomePart:Clone() --This will create a copy of a part from Lighting called AwesomePart
    awesomePart.Parent = game.Workspace --Moves the AwesomePart clone to the physical world
end)