Need help correcting my script

Sorry for being dumb, I’m a bit new at this.

Basically, I’m trying to generate a new part every time the player or anything else touches the part but it keeps saying “attempt to call a nil value”.

Capture

Please help?

You should first create the function and then connect it.

local Part = workspace.Part

local function blockadder()
	local NewPart = Instance.new("Part")
	NewPart.Parent = workspace
end

Part.Touched:Connect(blockadder)
1 Like

You need to create the function first as if you don’t the script doesn’t know what “blockadder” is.