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

Is there a way to spawn a new brick with a script in it?

I'm trying to make a dropper block that drops bricks with scripts in them. Could I use something that uses something like this?

p = Instance.new("Part")
p.Anchored = false
p.Position = Vector3.new(math.random(-500,500), 50, math.random(-500,500))
p.Size = Vector3.new(1,0.2,2)
p.Parent = game.workspace
p.BrickColor = BrickColor.new(37)
p.BackSurface = "SmoothNoOutlines"
p.BottomSurface = "SmoothNoOutlines"
p.FrontSurface = "SmoothNoOutlines"
p.LeftSurface = "SmoothNoOutlines"
p.RightSurface = "SmoothNoOutlines"
p.TopSurface = "SmoothNoOutlines"
wait()

1 comment

0

You can most likely apply the script to the created object in the same script it was created in :) Can you provide the code you wish to put inside the created object?

1 answer

✓ Accepted answer

Parent the clone script to your script that you typed above, and disable it.

After, just put:

local scriptclone = script:WaitForChild("ScriptNameHere"):Clone() -- change "ScriptNameHere" to name of script you want to clone inside the part.
scriptclone.Parent = p
scriptclone.Disabled = false

1 comment

0

Makes sense! I will try it!

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