I have a script that creates a tool, brings it into the StarterPack, names it, gives it a handle, etc. Everything in the script seems to be working fine, except for the OnActivation() function. What I'm trying to do is, on every mouse-click, a red brick will pop out of the bottom of the Handle of the tool.
tool = Instance.new("Tool")
tool.Parent = game.StarterPack
tool.GripPos = Vector3.new(0,-1.1,0)
tool.Name = "AlphaWand"
handle = Instance.new("Part")
handle.Name = "Handle"
handle.Parent = tool
handle.Size = Vector3.new(1,4,1)
handleBlockmesh = Instance.new("BlockMesh")
handleBlockmesh.Parent = handle
handleBlockmesh.Scale = Vector3.new(0.5,1,0.5)
local waitForTools = game.StarterPack:WaitForChild("AlphaWand")
function onActivated()
local df = Instance.new("Part")
df.Parent = game.Workspace
df.Name = "DROPFLARE"
df.BrickColor = BrickColor.new("Bright red")
df.Position = tool.Handle.Position
df.Anchored = false
df.CanCollide = false
df.Size = Vector3.new(1,2,1)
end
tool.Activated:connect(onActivated)
I've tried an if statement, so it checks to see if a brick under the name "DROPFLARE" is nil, and if it is, the output would print "Couldn't find flare". Apparently, that didn't work. I'm stumped here.

1 comment
It spawns a brick, I assume (from the small, quick freeze every time I click with it in my hand), but I just can't see the brick at all. I checked the Workspace while I was spawning some of the flares, and there weren't any listed there