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

I was making a script where when u activate a tool a new part is created but the script wont work?

local tool = script.Parent

function newPart() local part = Instance.new("Part") part.BrickColor = BrickColor.new("Lapis") part.Transparency = 0.6 part.Parent = game.Workspace part.Position = Vector3.new(0, 100, 0) end

tool.Activated:Connect(function(Mouse) Mouse.MouseButton1Down:Connect(function(newPart)

end)

end)

1 answer

I've changed up the script a bit, but it should work.

local tool = script.Parent

local function newPart() --[[added "local" before function]]
	local part = Instance.new("Part")
	part.BrickColor = BrickColor.new("Lapis")
	part.Transparency = 0.6
	part.Parent = game.Workspace
	part.Position = Vector3.new(0, 100, 0) 
end

tool.Activated:Connect(function()
	newPart() --[[removed MouseButton1Down thing because the tool is already being activated]]
end)

If it doesn't work, make sure you have a part inside the tool named "Handle".

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