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

Why does this script not create the part? [solved]

My script is supposed to spawn a new part 15 studs above a part named "trigger" in the model "mine"

When I click the button that the script is in, nothing happens. No errors. What is wrong?

function dropbrick()
	local brick = Instance.new("Part")
	brick.Position = game.Workspace:FindFirstChild("mine").trigger.Position + Vector3.new(0,15,0)
end

script.Parent.ClickDetector.MouseClick:connect(dropbrick)

2 comments

1

You need to parent it to the workspace

0

Wow, I didn't realize I didn't put that, thanks haha! +1

1 answer

✓ Accepted answer

Anything not a descendant of workspace will not show up to the players(any parts,gui's can be outside)

To add a part to workspace when you create it, do this.

part = Instance.new("Part",game.Workspace) -- the second parameter is the parent of the instance

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