CCCPaste

Allowed Car Access Script

local allowedUsernames = {"PamPam4021"}
local vehicleSeat = script.Parent

vehicleSeat:GetPropertyChangedSignal("Occupant"):Connect(function()
	local occupant = vehicleSeat.Occupant
	if occupant then
		local humanoid = occupant
		local player = game.Players:GetPlayerFromCharacter(humanoid.Parent)

		if player then
			-- ✅ Only punish if player is NOT allowed
			if not table.find(allowedUsernames, player.Name) then
				local message = Instance.new("Message")
				message.Parent = workspace
				message.Text = "You're not allowed in this vehicle.."
				task.wait(1)
				message:Destroy()

				humanoid.Health = 0
			end
		end
	end
end)