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

Cloning and Setting a cloned Objects Parent?

I've done this before a while ago now. And I've forgoten how to set the Parent of a cloned object upon beining cloned. The three scripts are as followed:

NOTE: HoloAwards Is what it says there a 3 diffrent ones 1st, 2nd and 3rd. At the end of the script it should be that the copys of them are in lighting, and they should be un-anchored at the end (Last thing to be done).

1ST SCRIPT:

HoloAwards = script.Parent
C1 = HoloAwards.HoloPart1st:Clone()
C1.Name = ("ClonedPartHoloAwards1st")
C1.Parent = ("Lighting")
C1.Locked = true
wait(5)
HoloAwards.HoloPart1st.Anchored = false

2ND SCRIPT:

HoloAwards = script.Parent
C2 = HoloAwards.HoloPart2nd:Clone()
C2.Name = ("ClonedPartHoloAwards2nd")
C2.Parent = ("Lighting")
C2.Locked = true
wait(5)
HoloAwards.HoloPart2nd.Anchored = false

3RD SCRIPT:

HoloAwards = script.Parent
C3 = HoloAwards.HoloPart3rd:Clone()
C3.Name = ("ClonedPartHoloAwards3rd")
C3.Parent = ("Lighting")
C3.Locked = true
wait(5)
HoloAwards.HoloPart3rd.Anchored = false

The patern is pretty obviouse but I'd thought I'd post all three anyway. In workspace HoloAwards is actually "Holo Awards" With a space but that shoudn't affect the script now should it? If anybody would take time to fix this I'd be so happy thanks.

3 comments

0

You are cloning the part in Lighting. However, things in Lighting except for certain light objects for example the blur effect, will not show.

0

game:GetService("Lighting")

0

Use ReplicatedStorage instead of Lighting, it was added to ROBLOX for this reason.

1 answer

Right now, you are trying to set C1, C2, and C3's Parents to a string. You want something like this . . .

C1.Parent = game.Lighting

The ".Parent" property takes a Ref that refers to an instance, therefore Parent must be set equal to an instance. As TheArmoredReaper mentioned, you can preferably use ServerStorage or ReplicatedStorage instead of Lighting.

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