Why this function don't work?

mouse.Button1Up:Connect(function()
	if player.Team == game.Teams.Blue then
		local part = Instance.new("Part")
		part.Size = 2,2,2
		part.Anchored = true
		part.Material = "Wood"
		part.BrickColor = BrickColor.new("Bright blue")
		part.Position = mouse.Hit.Position
		part.Parent = workspace
		if part.Position.X < 266.6 then
			part:Destroy()
		elseif part.Position.X > 426.4 then
			part:Destroy()
		elseif part.Position.Z < -401.6 then	
			part:Destroy()
		elseif part.Position.Z > -561.5 then
			part:Destroy()
		end
end)

I think the problem is in the parameters where you can put the part.

2 comments

0

on part.Size change it to Vector3.new() and put the 2,2,2 in there.

0

you need to use Vector3()