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

Changing properties of newly cloned objects?

Asked by 10 years ago
script.Parent.Touched:connect(function(hit)
    marble = game.Lighting.Marble:Clone()
    weld = Instance.new("Weld", marble)
    weld.Part1 = hit.Parent:findFirstChild("Torso")
    weld.Part2 = weld.Parent
end)

I'm trying to get a weld in a newly cloned part from lighting. It doesnt change parent of the marble to workspace and doesn't create the weld etc.

1 answer

Log in to vote
0
Answered by 10 years ago

you didn't assign a parent to the marble yet. It would look like this:

script.Parent.Touched:connect(function(hit)
    marble = game.Lighting.Marble:Clone()
    marble.Parent = game.Workspace --This sets the parent of the marble to workspace
    weld = Instance.new("Weld",marble)
    weld.Part1 = hit.Parent:FindFirstChild("Torso")
    weld.Part2 = weld.Parent
end)
Ad

Answer this question