How do I fix this?

Hello developers,

I have an issue with a system I am making and I am unsure how to fix it.

Problem:
https://gyazo.com/b6c0395f1818a86f0b863c40f639640c
As you can see the first player can get out of the vehicle fine, but one the other player, it does not work.

Server:

local CollectionService = game:GetService("CollectionService")
local Seats_Tag = "Seats"
local SeatsT = CollectionService:GetTagged(Seats_Tag)

local Players = game:GetService("Players")

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Activated = ReplicatedStorage:WaitForChild("Activated")
local Deactivated = ReplicatedStorage:WaitForChild("Deactivated")

local PlayerSitting = nil 

CollectionService:GetInstanceAddedSignal(Seats_Tag):Connect(function(Seat)
	table.insert(SeatsT, Seat)
end)

CollectionService:GetInstanceRemovedSignal(Seats_Tag):Connect(function(Seat)
	SeatsT = CollectionService:GetTagged(Seats_Tag)
end)

local function RemoveAccessorys(Player)
	for _, BaseParts in pairs(Player.Character:GetChildren()) do 
		if BaseParts:IsA("Accessory") then 
			BaseParts.Handle.Transparency = 1 
		elseif BaseParts:IsA("BasePart") then
			BaseParts.Transparency = 1
			BaseParts.CanCollide = false
		end
	end
end

local function AddAccessorys(Player)
	for _, BaseParts in pairs(Player.Character:GetChildren()) do 
		if BaseParts:IsA("Accessory") then 
			BaseParts.Handle.Transparency = 0
		elseif BaseParts:IsA("BasePart") then
			BaseParts.CanCollide = true
			BaseParts.Transparency = 0
		end
	end
end

local function SitPlayerInSeat(Seats)
	Seats.ProximityPrompt.Triggered:Connect(function(Player)
		if Seats.Occupant then
			return
		end

		Seats:Sit(Player.Character:WaitForChild("Humanoid"))
		Activated:FireClient(Player)
	end)

	Seats:GetPropertyChangedSignal("Occupant"):Connect(function()	
		if Seats.Occupant then
			local Humanoid = Seats.Occupant
			PlayerSitting = Players:GetPlayerFromCharacter(Humanoid.Parent)

			RemoveAccessorys(PlayerSitting)
		else
			wait(0.1)
			if Seats.Name == "FR" or Seats.Name == "BR" or Seats.Name == "Middle" then
				PlayerSitting.Character.HumanoidRootPart.CFrame = Seats.Parent.RightSide.CFrame
			elseif Seats.Name == "BL" then
				PlayerSitting.Character.HumanoidRootPart.CFrame = Seats.Parent.LeftSide.CFrame
			elseif Seats.Name == "DriveSeat" then
				PlayerSitting.Character.HumanoidRootPart.CFrame = Seats.Parent.Body.LeftSide.CFrame
			end

			Deactivated:FireClient(PlayerSitting)
			AddAccessorys(PlayerSitting)
			PlayerSitting.Character.HumanoidRootPart.Transparency = 1
			PlayerSitting = nil
		end
	end)
end

local function GetAllSeats()
	for _,Seats in pairs(CollectionService:GetTagged(Seats_Tag)) do 
		SitPlayerInSeat(Seats)
	end
end

GetAllSeats()

Client:

local CollectionService = game:GetService("CollectionService")
local Seats_Tag = "Seats"

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Activated = ReplicatedStorage:WaitForChild("Activated")
local Deactivated = ReplicatedStorage:WaitForChild("Deactivated")

Activated.OnClientEvent:Connect(function()
	for _, Seat in pairs(CollectionService:GetTagged(Seats_Tag)) do 
		Seat.ProximityPrompt.Enabled = false
	end
end)

Deactivated.OnClientEvent:Connect(function()
	for _, Seat in pairs(CollectionService:GetTagged(Seats_Tag)) do 
		Seat.ProximityPrompt.Enabled = true
	end
end)

I am certain I know the issue is involved with local PlayerSitting = nil since it is on the server. Like I said above, I do not know how to fix it.

I’m not quite sure if this will work but it’s all I can think of without being able to test it in studio. I think that you should try using a table instead of a variable for PlayerSitting. For example, you would insert the player into the table and then run your code when they enter or leave.

The variable PlayerSitting is set to nil whenever one of the players leaves. Then once the other player leaves the variable is still nil. Therefore it cannot add or remove their accessories causing them to still be transparent.

I understand how this could work when the player is sitting. However, how would this work when there is not a seat occupant to verify it is the player getting up.