Placement system is not moving items on the grid

Hello,
I have an issue with my current placement system, all items in my game have been working fine but I added a new item (funnel) and it stopped going on the grid, it only happens with the smaller variants, but I think it has something to do with how my system snaps on the grid for different sizes.

Video

Script

Get Even Function

local function geteven(size)
			local sizefloor = math.floor(size)
			local even = sizefloor % 2 == 0
			
			if even then
				even = 0.5
			else
				even = 0
			end
			
			return even
		end

Move function

local function moveitem()
			if mouselocation ~= mouse.Hit.Position or mouserotation ~= rotation then
				if plr:DistanceFromCharacter(mouse.Hit.Position) < 300 then
					mouselocation = mouse.Hit.Position
					mouserotation = rotation
					local cframe, size = model:GetBoundingBox()
					
					local evenx
					if rotation == 90 or rotation == -90 then
						evenx = geteven(size.Z)
					else
						evenx = geteven(size.X)
					end
					local evenz
					if rotation == 90 or rotation == -90 then
						evenz = geteven(size.X)
					else
						evenz = geteven(size.Z)
					end
					
					local newposition = Vector3.new(math.round(mouse.Hit.Position.X) - evenx, size.y / 2 + 2.5, math.round(mouse.Hit.Position.Z) - evenz)
					local newrotation = CFrame.Angles(0, math.rad(rotation), 0)
					local newcframe = CFrame.new(newposition) * newrotation
					model:PivotTo(newcframe)
					getcollisions()
				end
			end
		end

When I change the get even function to if not even then it works with the small funnels but all other items don’t work
Any help is appreciated!

Found a solution, regrouping the model fixes the issue, seems like the pivot point wasn’t alligned correctly

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.