Part.Touched Does Not Work Correctly

im creating a collision sytem yor my game but it doesn’t work, i did a video but it goes at 5 fps
here’s the script:

localScript:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local PhysicsService = game:GetService("PhysicsService")
local UserInputService = game:GetService("UserInputService")

local Objects = ReplicatedStorage:WaitForChild("Furniture")
local Events = ReplicatedStorage:WaitForChild("Events")
local SpawnFurnitureEvent= Events:WaitForChild("SpawnFurniture")

local Camera = workspace.CurrentCamera

local Gui = script.Parent
local Inventory = Gui.Inventory
local Categories = Gui.Categories
local Template = Inventory.Template
local Model = nil

local IsPlacing = false

local function MouseRaycast(blacklist)
	local MousePosition = UserInputService:GetMouseLocation()
	local MouseRay = Camera:ViewportPointToRay(MousePosition.X, MousePosition.Y)
	local raycastParams = RaycastParams.new()
	raycastParams.FilterType = Enum.RaycastFilterType.Exclude
	raycastParams.FilterDescendantsInstances = blacklist

	local RaycastResult = workspace:Raycast(MouseRay.Origin, MouseRay.Direction * 1000, raycastParams)
	return RaycastResult
end

function CreateTemplate(ModelName)
	local model = Objects:FindFirstChild(ModelName, true)
	if model then
		Model = model:Clone()
		Model.Parent = workspace
		for i, object in ipairs(Model:GetDescendants()) do
			if object:IsA("BasePart") then
				PhysicsService:SetPartCollisionGroup(object, "FurnitureTemplate")
				object.Material = Enum.Material.ForceField
			end
		end
	end
end

function Create3D(ViewportFrame, ViewportImage)
	local Distance = ViewportImage.PrimaryPart.Size.X + ViewportImage.PrimaryPart.Size.Z - ViewportImage.PrimaryPart.Size.Y
	if ViewportImage.PrimaryPart.Size.X < ViewportImage.PrimaryPart.Size.Y and ViewportImage.PrimaryPart.Size.Z < ViewportImage.PrimaryPart.Size.Y then
		Distance = ViewportImage.PrimaryPart.Size.Y
	end
	local cframe = CFrame.new(0,0,Distance * -1)
	ViewportImage:PivotTo(cframe)
	local Camera = Instance.new("Camera", ViewportFrame)
	ViewportFrame.CurrentCamera = Camera
	ViewportFrame.CurrentCamera.CFrame = CFrame.new(0,0,0)
	while RunService.Stepped:Wait() do
		cframe = ViewportImage.PrimaryPart.CFrame * CFrame.Angles(0,math.rad(2),0)
		ViewportImage:PivotTo(cframe)
	end
end

for i, object in pairs(Objects:GetDescendants()) do
	if object:IsA("Model") then
		local Tab = Template:Clone()
		Tab.FurnitureName.Text = object.Name
		Tab.Name = object.Name
		local ViewportImage = object:Clone()
		ViewportImage.Parent = Tab.ViewportFrame
		coroutine.wrap(Create3D)(Tab.ViewportFrame, ViewportImage)
		Tab.Visible = true
		Tab.Parent = Inventory
		Tab.MouseButton1Click:Connect(function()
			if IsPlacing == false then
				IsPlacing = true
				CreateTemplate(object.Name)
			end
		end)
	end
end

function ChangeCategory(categoryName)
	for i, object in pairs(Objects:GetDescendants()) do
		if object:IsA("Model") then
			if categoryName == "All" then
				Gui.Inventory[object.Name].Visible = true
			else
				if object.Parent.Name == categoryName then
					Gui.Inventory[object.Name].Visible = true
				else
					Gui.Inventory[object.Name].Visible = false
				end
			end
		end
	end
end

for i, category in pairs(Categories:GetChildren()) do
	if category:IsA("GuiButton") then
		category.MouseButton1Click:Connect(function()
			ChangeCategory(category.Name)
		end)
	end
end

UserInputService.InputBegan:Connect(function(input, processed)
	if processed then return end
	
	if Model then
		if input.UserInputType == Enum.UserInputType.MouseButton1 then
			SpawnFurnitureEvent:FireServer(Model.Name, Model.PrimaryPart.CFrame)
			Model:Destroy()
			Model = nil
			IsPlacing = false
		end
	end
end)

RunService.RenderStepped:Connect(function()
	if Model then
		local result = MouseRaycast({Model})
		if result and result.Instance then
			local x = result.Position.X
			local y = result.Position.Y + (Model.PrimaryPart.Size.Y / 2)
			local z = result.Position.Z
			
			Model.PrimaryPart.Touched:Connect(function(hit)
				--some function im gonna add
			end)
			
			local cframe = CFrame.new(x,y,z)
			Model:SetPrimaryPartCFrame(cframe)
		end
	end
end)

hope this hepls to help me

oh i forgot, the part.touched works if it touches the player character