I am trying to duplicate a room only on the client, and I already have that down.The issue is that the detector (which detects the play with part.Touched) calls twice, even though we have a variable that should stop that.

out: https://imgur.com/a/95nyZak

I have tried re-enabling the variable after to see if I was re-enabling to quickly, but that does not fix the issue. This is ran in a server script, and I am stuck on what to do to fix it. I imagine it is something stupid that I have done, but I do not know. It should also be noted that it is the touched event being called twice, not me calling the function by mistake.

Code:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetService("ServerStorage")
local Players = game:GetService("Players")

local Remotes = ReplicatedStorage:WaitForChild("Remotes")
local Modules = ReplicatedStorage:WaitForChild("Modules")

local GetDataServer = ServerStorage.Bindables.GetDataServer
local ChangeValue = ServerStorage.Bindables.ChangeValue
local ClientDuplication = Remotes:WaitForChild("ClientDuplication")
local ClientPropertyAssignment = Remotes:WaitForChild("ClientPropertyAssignment")
local DefaultData = require(Modules:WaitForChild("DefaultData"))

local part = script.Parent 
local tpLocation = script.TPLocation.Value.Position
local defaultOffice = script.Target.Value
local clientDir = workspace.ClientRooms
local windowsTransparencyLevel = 0.8
local office = workspace.Office
local playerWindows = office.PlayerWindows
local canEnter = true

function PropertyWindows(player, dir)
	for _, window in pairs(dir:GetChildren()) do
		ClientPropertyAssignment:FireClient(player, window, "Transparency", windowsTransparencyLevel)
		
	end
	
end

part.Touched:Connect(function(collider)
	if not collider or not collider.Parent:FindFirstChild("Humanoid") or not canEnter then return end
	canEnter = false;
	print(collider.Name)