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

Changing properties of newly cloned objects?

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

✓ Accepted answer

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)

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