Size is not a valid member of Script - Script Error

Hello,

I was trying to piece together a part grabbing script that I was trying to make in a Tutorial. The tutorial is a about half a year old so I think Roblox might have done something with this.

The part of my script allows the server to change the color and size of the part through random number generation.

I think this is a simple error but I have no idea how to fix this,
The error I get is:

Size is not a valid member of Script “ServerScriptService.PickupHandler” - Server - PickupHandler:9

part.Size/4th line is the line that I get the error on.

local rng =  Random.new()
for _,part in pairs(parts) do
	part.Size = Vector3.new(rng:NextNumber(1,4), rng:NextNumber(1,4), rng:NextNumber(1,4)) ------Error Line
	part.Color = Color3.new(rng:NextNumber(0,1), rng:NextNumber(0,1), rng:NextNumber(0,1))
	part.Anchored = true
	part.CanCollide = false
	local bp = Instance.new("BodyPosition")
	local bg = Instance.new("BodyGyro")
	bp.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
	bp.Position = part.Position
	bp.D = 500
	bg.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
	bg.CFrame = part.CFrame
	bp.Parent = part
	bg.Parent = part
end

Thank you for your help!

What is the table called parts?

1 Like

local TAG_NAME = “Pickup”

local collectionService = game:GetService(“CollectionService”)

local parts = collectionService:GetTagged(TAG_NAME) ---- I think this is the line you are looking for

local playerParts = {}

You probably accidentally tagged a script with the “Pickup” tag.

1 Like