Script overwrites the car's appearance

I’m trying to do a saved car’s frame, where the player can save their car.
But whenever I view a car, it would show the same car. but when I go to an empty slot and view the recently saved car, It shows its appearance and makes all slots have the same look. Although this doesn’t affect data.

Media

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Player = game.Players.LocalPlayer
local Folder = Player.carsSaved
local Cache = script.Parent.Parent.cache
local UImodule = require(script.Parent.Parent.Parent.MainModule)
local World = game:GetService("Workspace")

local oneSeat = ReplicatedStorage:FindFirstChild("Vroom"..Player.Name)
local oneSeatWorkspace = World:FindFirstChild("Vroom"..Player.Name)

local twoSeat = ReplicatedStorage:FindFirstChild("VroomB"..Player.Name)
local twoSeatWorkspace = World:FindFirstChild("VroomB"..Player.Name)

local delete = script.Parent.delete
local overwrite = script.Parent.overwrite
local rename = script.Parent.rename 
local spawncar = script.Parent.spawn
local label = script.Parent.Parent.carName
local gradientFrame = script.Parent.Parent.Frame
local gradientBorder = gradientFrame.UIGradient
local licenseView = script.Parent.licensePreview
local decalView = script.Parent.decalPreview

local model = script.Parent.Vroom

local left = script.Parent.controlB
local right = script.Parent.controlA

local page = 1

local defaultFormat = "name~carColor~logoColor~decal~license"

local round = math.round

local function viewCar(slot)
	model.Parent = script.Parent
	decalView.Visible = true
	licenseView.Visible = true
	local stringg = string.split(slot,"~")

	local nameValue = tostring(stringg[1])
	local carValue = tostring(stringg[2])
	local logoValue = tostring(stringg[3])
	local decalValue = tostring(stringg[4])
	local licenseValue = tostring(stringg[5])
	
	local logValueresult = string.split(logoValue,",")
	local r, g, b = round(logValueresult[1]*255), round(logValueresult[2]*255), round(logValueresult[3]*255)

	local logValueresult = string.split(carValue,",")
	local H, S, L = round(logValueresult[1]*255), round(logValueresult[2]*255), round(logValueresult[3]*255)

	print(
		nameValue,
		carValue,
		logoValue,
		decalValue,
		licenseValue)

	if decalView == "decal" then
		print("Viewed car has no decal.")
	else
		decalView.Image = decalValue
	end

	licenseView.Text = licenseValue
	label.Text = nameValue
	overwrite.Text = "Overwrite"
	model.log.Union.Color = Color3.fromRGB(r,g,b)

	for _, v in pairs(model.Model:GetChildren()) do
		if v.Name == "canChange" then
			v.Color = Color3.fromRGB(H,S,L)
		end
	end

	gradientFrame.Visible = true
	UImodule.CreateGradientBorderForPreview(gradientBorder, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 2)
end

local function slotEmpty()

	model.Parent = script.Parent.Parent.cache

	local a=Instance.new"TextLabel"
	a.Size=UDim2.new(0.521, 0,0.141, 0)
	a.BackgroundTransparency=1
	a.Position=UDim2.new(0.2475411,0,0.5461732,0)
	a.BackgroundColor3=Color3.fromRGB(255,255,255)
	a.FontSize=5
	a.TextSize=14
	a.RichText=true
	a.TextColor3=Color3.fromRGB(255,255,255)
	a.Text="Oh <i>look</i>, an empty <b>slot!</b>"
	a.TextWrap=true
	a.Font=35
	a.TextWrapped=true
	a.TextScaled=true
	a.ZIndex = 2
	local b=Instance.new"ImageLabel"
	b.Size=UDim2.new(0.229, 0,1.483, 0)
	b.BackgroundTransparency=1
	b.Position=UDim2.new(0.3856969,0,-1.3461798,0)
	b.BackgroundColor3=Color3.fromRGB(255,255,255)
	b.Image="rbxassetid://8635740892"
	b.Parent=a
	b.ZIndex = 2
	a.Parent=script.Parent

	label.Text = "Empty Slot"
	overwrite.Text = "Use Slot"
	gradientFrame.Visible = false
end

if Folder:FindFirstChild("Slot1").Value == defaultFormat then
	slotEmpty()
elseif Folder:FindFirstChild("Slot1").Value ~= defaultFormat then
	for i, v in ipairs(Folder:GetChildren()) do

		if script.Parent:FindFirstChild("TextLabel") then
			script.Parent:FindFirstChild("TextLabel"):Destroy()
		end
		local pageInfo = Folder:FindFirstChild("Slot"..page).Value
		viewCar(pageInfo)
	end
end

right.MouseButton1Click:Connect(function()
	page = page + 1

	if page == 1 then
		left.Visible = false
	end


	if page >= 2 then
		left.Visible = true
	end

	if page == 5 then
		right.Visible = false
	end

	for i, v in ipairs(Folder:GetChildren()) do
		local pageInfo = Folder:FindFirstChild("Slot"..page).Value

		if pageInfo == defaultFormat then

			if script.Parent:FindFirstChild("TextLabel") then
				script.Parent:FindFirstChild("TextLabel"):Destroy()
			end
			
			decalView.Visible = false
			licenseView.Visible = false
			slotEmpty()
		elseif script.Parent:FindFirstChild("TextLabel") and pageInfo ~= defaultFormat then
			model.Parent = script.Parent
			viewCar(pageInfo)

			if script.Parent:FindFirstChild("TextLabel") then
				script.Parent:FindFirstChild("TextLabel"):Destroy()
			end

		elseif script.Parent:FindFirstChild("TextLabel") and pageInfo == defaultFormat then
			script.Parent:FindFirstChild("TextLabel"):Destroy()
			slotEmpty()
			decalView.Visible = false
			licenseView.Visible = false
		end
	end

end)

left.MouseButton1Click:Connect(function()
	page = page -1

	if page == 1 then
		left.Visible = false
	end


	if page >= 2 then
		left.Visible = true
	end

	if page == 4 then
		right.Visible = true
	end

	if page == 5 then
		right.Visible = false
	end

	for i, v in ipairs(Folder:GetChildren()) do
		local pageInfo = Folder:FindFirstChild("Slot"..page).Value

		if pageInfo == defaultFormat then
			
			if script.Parent:FindFirstChild("TextLabel") then
				script.Parent:FindFirstChild("TextLabel"):Destroy()
			end
			
			decalView.Visible = false
			licenseView.Visible = false
			slotEmpty()

		elseif script.Parent:FindFirstChild("TextLabel") and pageInfo ~= defaultFormat then
			model.Parent = script.Parent
			viewCar(pageInfo)

			if script.Parent:FindFirstChild("TextLabel") then
				script.Parent:FindFirstChild("TextLabel"):Destroy()
			end

		elseif script.Parent:FindFirstChild("TextLabel") and pageInfo == defaultFormat then
			script.Parent:FindFirstChild("TextLabel"):Destroy()
			slotEmpty()
			decalView.Visible = false
			licenseView.Visible = false
		end
	end
end)

overwrite.MouseButton1Click:Connect(function()
	for i, v in ipairs(Folder:GetChildren()) do
		local pageInfo = Folder:FindFirstChild("Slot"..page)
		
		ReplicatedStorage.overwriteSaved:FireServer(pageInfo)
		wait(0.2)
		if script.Parent:FindFirstChild("TextLabel") then
			script.Parent:FindFirstChild("TextLabel"):Destroy()
		end
		viewCar(pageInfo.Value)
	end
end)

Can you pinpoint exactly in the script where the issues are occurring/taking place?

I think it’s mostly happening in local function viewCar(slot) since it’s the function that lets the player view the cars.